dragonflydb / dragonfly

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

Search bug #1995

Open yovanoc opened 9 months ago

yovanoc commented 9 months ago

I know you just add support for search but I thought reporting you this can help.

When we follow the example here https://redis.io/docs/interact/search-and-query/indexing/

this command return nothing:

127.0.0.1:6379> FT.SEARCH itemIdx '@description:(bluetooth headphones) @price:[0 70]'
1) (integer) 0

json arrays as tag doesn't work too, and json arrays as text gives syntax error

dranikpg commented 9 months ago

Hi! 👋🏻 Thanks for the report. True, also numeric arrays can be indexed as multi-value entries. Will fix that soon

yovanoc commented 9 months ago

The debug memory command will be very useful too

yovanoc commented 8 months ago

And JSON.MSET . Where can we see your plans on implementing or not things ?

romange commented 8 months ago

@yovanoc if there is no issue then we unlikely implement it. Please open an issue for json.mset.

yovanoc commented 8 months ago

CleanShot 2023-10-15 at 19 25 43

I get crashes on simples

FT.CREATE myIdx ON JSON PREFIX 1 thepath- SCHEMA $.the.deep.key AS theKey NUMERIC
FT.SEARCH myIdx '@theKey:(1)'
dranikpg commented 8 months ago
  1. 2015 will fix the original issue with numbers, I will follow up with json arrays afterwards

  2. What version of Dragonfly are you using? Please use only the latest version (or even better the main branch though it can be a little bumpy) image Also, please use only the range type query for numerics for now image
  3. I'm really interested what you're using search for? Just experimenting or some kind of project 🙂 I'm open to hearing any complains about missing features, performance and of course bugs. All of this helps us to improve the feature before officially launching it
yovanoc commented 8 months ago

CleanShot 2023-10-16 at 10 45 08

1.10 so the last apparently but it still crashes

but thanks for advices I will use ranges for now, and my use case is a big microservices project in cybersecurity that need to search through CVA etc

dranikpg commented 8 months ago

@yovanoc

We released 1.11 today and it should contain some fixes 🔥 For example, there should be no easy way to crash Dragonfly at all (before I didn't expect search to have actually any users at all). The latest fixes are unfortunately not included in this issue

yovanoc commented 8 months ago

Will look at it very soon! 🔥

admtech commented 8 months ago

@yovanoc

..before I didn't expect search to have actually any users at all..

Of course, we are already testing the search. Ultimately, the search with Json and an index would facilitate many things and bring DragonflyDB to a whole new level. A Redis alternative without modules that can do Json, Geo and Fulltext, but is much more efficient and faster. A dream

Here is another error in the search I just found: The sorting does not work after a restart. The search field defined in the index is not found after the restart ((error) ERR Invalid sort field). Directly after creating the index it still works, after restarting the DB it doesn't work anymore.

If I could wish something for the search would be the WITHSCORES output (with the hope that the current search as in Redis by default sorted by relevance) and the extension of the index with the simple GEO point search (distance) eg by definition in the index „$.location AS location GEO" and then FT.SEARCH searchIdx "@title Linux @location:[-0.441 51.458 1 km]". We run an IT job search that searches by job title and distance. This would be great.

Much you have already finished: The most important FT-commands (info, drop, etc). Also Limit works well, the search in tags we have tested so far only with numeric arrays values, so we had not noticed the error above until now.

FT.SEARCH searchIDS "@tags:{972739643}"with numeric Json Array [972739643, 972739641, 972739670,..] with "$.tags.* AS tags TAG" works for us. Thanks for the bug report. If the SORT BY field works after the restart we will test further :-)

dranikpg commented 8 months ago

@admtech

Hi! Happy to see courageous users ready to try out brand new features 😀

  1. I just fixed the persistence bug, now SORTABLE NOINDEX should be correctly serialized in snapshots. I'll trigger a docker build, by the end of this day it should be available on ghcr.io/dragonflydb/dragonfly-weekly (please note that's the main branch version, it can be a little bit bumpy)

  2. We currently do not have GEO commands implemented in Dragonfly, once we do it can be made possible. Scoring is an important feature, but really requires some effort to implement

  3. It might work for tags, but rightfully noted it doesn't for all field 🙂 Will be fixed

Feel free to reach out about any issues you encounter