Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IsIndexCurrentAsync always returns false #494

Open
obradl opened this issue Oct 11, 2024 · 0 comments · May be fixed by #496
Open

IsIndexCurrentAsync always returns false #494

obradl opened this issue Oct 11, 2024 · 0 comments · May be fixed by #496

Comments

@obradl
Copy link

obradl commented Oct 11, 2024

Hi,

It seems like IsIndexCurrentAsync always returns false when I try the new feature. In this example the code hits the lines with DropIndexAsync and CreateIndexAsync for every run. I first run the sample and the index is created. Then I do another run and IsIndexCurrentAsync return false when there is no changes in the model (an the index exists from previous run).

using Redis.OM;
using Redis.OM.Modeling;

var provider = new RedisConnectionProvider("redis://localhost:6379");
var isIndexCurrentAsync = await provider.Connection.IsIndexCurrentAsync(typeof(Customer));

if (!await provider.Connection.IsIndexCurrentAsync(typeof(Customer)))
{
    await provider.Connection.DropIndexAsync(typeof(Customer));
    await provider.Connection.CreateIndexAsync(typeof(Customer));
}


[Document(StorageType = StorageType.Json,  Prefixes = new[] { "test" })]
public class Customer
{
    [Indexed] public string FirstName { get; set; }
    [Indexed] public string LastName { get; set; }
    public string Email { get; set; }
    [Indexed(Sortable = true)] public int Age { get; set; }
    [Indexed] public string[] NickNames { get; set; }
}

Versions:
Redis OM v. 0.7.5
RediSearch v. 2.8.13
RedisJson v. 2.6.10

@slorello89 slorello89 linked a pull request Oct 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant