query
query copied to clipboard
How to implement lexicographic search?
One of the planned features of this project is :
- [ ] Range Queries: Query your data with range queries. Either numeric or lexicographic.
However, this is not implemented and I doubt this will ever be without a community PR. I am willing to try to implement a basic version of this.
Can you help me figuring out the right approach? I guess the naive approach is to create a sorted set with one entry with same score per word (e.g. for "apple banana kiwi", ZADD myindex 0 "apple" 0 "banana" 0 "kiwi"). To search for a value, one can then use ZRANGEBYLEX myindex "[bana" "[bana\xff". I guess the next step would be to implement a "suffix trie" as done by FT.CREATE but I have no idea how it should be done/what primitives to use.