Imagine, i have index with field price. I want to find all document where 'price [0 10]' OR 'price [100 1000]'.
Can i do it?
Yes. you can do something like @price:[0-100]|@price:[200-600]. I haven't tested it but in principle it should work.
I already test it and it's not working :(
FT.CREATE indexName SCHEMA price NUMERIC
FT.ADD indexName doc7 1 FIELDS price 150
FT.ADD indexName doc8 1 FIELDS price 1500
FT.SEARCH indexName "@price:[0 200]"
- correct
FT.SEARCH indexName "@price:[0 200]|@price:[200 1700]"
(error) Syntax error at offset 14 near '200'
Okay, I'm planning a rewrite of the parser in the coming week, this will be added to it.
Thank's a lot
@onexdrk This has been fixed in the latest master version. You can now also view the query parse tree to make sure it works as expected:
$ redis-cli --raw
127.0.0.1:6379> ft.explain rd "@date:[0 100]|@date:[300 400]"
UNION {
NUMERIC {0.000000 <= x <= 100.000000}
NUMERIC {300.000000 <= x <= 400.000000}
}
This fix is included in release 0.17