1

I have a data on which i need to do search based on mutiple queries eg

list1=redisClient.zrangebyscore('FID', min=20150000, max=20190000)

the above code gives me all values for FID(First intriductory date ) which has date between 2015 jan to 2019 jan.So it gives me the desired result but i would also like to append this search the result set based on date and NTM value as 1 for all the dates between 205 jan to 2019 jan .

list2 =redisClient.zrangebyscore('NTM', min=1, max=1)

How can i club both these search conditions together .

1 Answer 1

2

The only way to do it with a single search is to find a clever way of encoding both values (FID and NTM) in a single score. If there isn't such a clever way, you'll need to perform both searches and then intersect the results yourself.

Tip: instead of doing the intersection in your application code, look into using Redis' Lua scripts to save on network bandwidth and latency.

Sign up to request clarification or add additional context in comments.

1 Comment

I achieved it with the second approach you mentioned.thanks using sinter on zadd and sadd data types.zadd set had to converted back to sadd using redisClient.sadd('a', *set(list1)) and then i was able to do intersection on both sets to find commn data

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.