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

Not able to query data on a new index. #236

Open
dealerpickupadmin opened this issue Jan 7, 2024 · 0 comments
Open

Not able to query data on a new index. #236

dealerpickupadmin opened this issue Jan 7, 2024 · 0 comments

Comments

@dealerpickupadmin
Copy link

  • to an existing json i have added a new index called StoreId.
  • then i tried to query using storeId and getting 0 response.
  • when checked in redis logs, index creation seems to be done fine.
    please suggest.

screenshot from redis stack
image

c#code:
.. Get Call
return await _customerAssociation.Where(c => c.StoreId == storeId).ToListAsync();

.. Class
[Document(StorageType = StorageType.Json, Prefixes = new[] { "CustomerAssociation" })]
public class CustomerAssociation
{
[RedisIdField]
public long Id { get; set; }

    [Indexed] public long StoreId { get; set; }

    [Indexed] public long CustomerId { get; set; }

... Index Creation
public class IndexCreationService : IHostedService
{
private readonly RedisConnectionProvider _provider;
public IndexCreationService(RedisConnectionProvider provider)
{
_provider = provider;
}

    public async Task StartAsync(CancellationToken cancellationToken)
    {
        await _provider.Connection.CreateIndexAsync(typeof(CustomerAssociation));
    }

    public Task StopAsync(CancellationToken cancellationToken)
    {
        return Task.CompletedTask;
    }
}
this class is added in startup and is being called when app starts


Please suggest what i am missing here
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

No branches or pull requests

1 participant