Search code examples
redisstackexchange.redisspring-data-redis

Secondary Index in Redis via StackExchange.Redis


With Spring data redis @indexed I am able to set a index in the Redis.

just defining my domain like this

@RedisHash("customer")
    public class Customer extends Serializble{

    @Id
    Private String CustomerId;
    @Indexed
    Private String CustmerName;
    …
    }

I am trying to achieve the came with C# StackExchange.Redis. Successfully able to create the Hash

IDatabase db = redis.GetDatabase(Variables.RedisDatabaseIndex);


db.HashSet(Row.customerId, new HashEntry[] {new HashEntry("customerName", Row.customerName) )

The problem is I am not able to create Index similar to the Indexed option in the spring data redis. I tried to get from the stackexchange.redis documentation but couldn't find any solution to this. Any pointers would help


Solution

  • Essentially, SE.Redis simply exposes the core redis commands and primitives. If you know what commands you want to issue: SE.Redis will help you. It does not, however, attempt to offer more complex scenarios. You can usually do those things - whether manually of via tools like RediSearch - but: you'll need to figure out that part yourself. When you know what you want to do, SE.Redis will help you ask the server to do it. Either directly, or via wrappers like NRediSearch.