Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
357 views
in Technique[技术] by (71.8m points)

Redis ZSCAN MATCH case insensitive search

I have a list of places stored in Redis Sorted Set

ZADD PLACES 1 "The Clift Royal Sonesta Hotel"

Now, I want to make a case insensitive search on word "Royal". I use ZSCAN for this as below:

ZSCAN LOCATION_TRENDING 0 MATCH "*royal*" COUNT 10

ZSCAN works when I make search with "Royal" (letter R capital) but not with "royal" (letter r small).

How to make case insensitive ZSCAN match? Please guide. Thanks.

question from:https://stackoverflow.com/questions/65832452/redis-zscan-match-case-insensitive-search

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It isn't possible to scan case insensitive. Like a workaround, you can duplicate your data with different keys and transform it to lowercase before storing.

Also, you can look through RedisSearch module if you need a complex search.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...