-
Notifications
You must be signed in to change notification settings - Fork 23.5k
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
Want the data in sorted manner based on their scores from sorted set. #7477
Comments
i think you're looking for https://redis.io/commands/zrange |
zrange gives the data in a given range but I want to get the data based on some regex that should give all the string which follow that regex with sorted score. For Example : ZSCAN test3 0 MATCH t
If you observe the result here the string is coming with their scores but that is not in sorted manner. |
that's right, ZRANGE can give you the entire sorted set, but with no filtering. and ZSCAN doesn't do sorting. |
Since wanted to implement autocompletion so fetching the data each time for different regex that would be highly costly task. |
@rajneran-quot so your LUA script can fetch just the first n results, and even do incremental calls to LRANGE and abort the "scan" when enough results were collected. i'm guessing there are better way, maybe involving a module. @itamarhaber might be able to point to something. |
@itamarhaber can you check and let me know is there any better way ? |
Hello @rajneran7890 As @oranagra said, I'd go with a Lua script to implement this using vanilla Redis. Alternatively, you can extend Redis with the RediSearch module and use its autocomplete feature (i.e |
@itamarhaber getting this while loading the redissearch.so any idea why so ? |
Redis modules were added to Redis v4 - which version are you using? |
redis_version:4.0.14 |
This doesn't make sense... unless you're using a managed Redis service where this functionality has been turned off? Although if that's the case I'm not sure how you got the .so file there in the first place. |
ZADD add the data in sorted set with score and some value while fetching the data wanted the data to be sorted based on their scores. Tried with ZSCAN but didn't get desired result
The text was updated successfully, but these errors were encountered: