dragonflydb / dragonfly

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

Full-text search errors for prefix match #3014

Open okimonhgb opened 1 month ago

okimonhgb commented 1 month ago

Describe the bug Fulltext search gives error if I want to search for words that match a given prefix: FT.SEARCH idxe:content "@text:football*" "ERR Query syntax error"

To Reproduce Steps to reproduce the behavior:

  1. Insert records : A json type key with a text field called "text".
  2. Create a full-text index: FT.CREATE indxe:content ON JSON PREFIX 1 contents: SCHEMA $.text AS text TEXT
  3. Query records using : FT.SEARCH idxe:content "@text:football*"
  4. It gives error: "ERR Query syntax error"

Expected behavior for exact search I get no error: FT.SEARCH idxe:content "@text:football" My existing app. running on Redis doesn't get any error for prefix matching as expected:

https://redis.io/docs/latest/develop/interact/search-and-query/query/full-text/

... Word prefix You can also search for words that match a given prefix.

FT.SEARCH index "prefix*" ... <<<

Screenshots Error with dragonfly: image

No error with Redis: image

Environment (please complete the following information):

Reproducible Code Snippet FT.CREATE indxe:content ON JSON PREFIX 1 contents: SCHEMA $.text AS text TEXT

FT.SEARCH idxe:content "@text:football*"

Minimal code snippet to reproduce this bug

FT.SEARCH idxe:content "@text:football*"

Additional context Add any other context about the problem here.

chakaz commented 1 month ago

@dranikpg can you kindly take a look? :pray:

romange commented 1 month ago

@okimonhgb is it full text search? it's not supported. indeed I do not see that it is clearly specified in the documentation.

okimonhgb commented 1 month ago

@romange yes it is full text search. It works for exact word searches but seems doesn't support word prefixes. Is it planned to be supported in near future? Is there any workaround? We want to use replace our redis instance with dragonfly but this problem breaks existing codes.

romange commented 1 month ago

Unfortunately it won't be implemented in near future.

okimonhgb commented 1 month ago

Ok. I understand there is also no workaround? So we should plan according to this. Can I keep this issue open? Best regards,

romange commented 1 month ago

Sure :)