dragonflydb / dragonfly

A modern replacement for Redis and Memcached
https://www.dragonflydb.io/
Other
25.98k stars 955 forks source link

Support null values in indexes #4107

Open BagritsevichStepan opened 2 weeks ago

BagritsevichStepan commented 2 weeks ago

Describe the bug The FT.SEARCH and FT.AGGREGATE commands do not index documents with null fields.

For example,

Initialize:

127.0.0.1:6379> JSON.SET j1 . '{"id":null}'
OK
127.0.0.1:6379> JSON.SET j2 . '{"id":1}'
OK
127.0.0.1:6379> FT.CREATE index ON JSON SCHEMA $.id AS id NUMERIC
OK

Redis:

127.0.0.1:6379> FT.SEARCH index "*"
1) (integer) 2
2) "j2"
3) 1) "$"
   2) "{\"id\":1}"
4) "j1"
5) 1) "$"
   2) "{\"id\":null}"

DragonflyDB:

127.0.0.1:6379> FT.SEARCH index "*"
1) (integer) 1
2) "j2"
3) 1) "$"
   2) "{\"id\":1}"