valeriansaliou / sonic

🦔 Fast, lightweight & schema-less search backend. An alternative to Elasticsearch that runs on a few MBs of RAM.
https://crates.io/crates/sonic-server
Mozilla Public License 2.0
20k stars 575 forks source link

No results when the keyword is part of the indexed term #166

Closed ghost closed 5 years ago

ghost commented 5 years ago

Guessing I ingest the object key in this way (I am currently using the php-client Psonic) $ingest->push($collection, $bucket, $object_key, "Search Index");

I am getting results on the search when the keywords are search, index, search term ... or any combination of the characters of the search term above, always that is taking the start of the word. I mean, it will return the object key if I use "sea" but not if I use "earc". But I saw you can manage to do that on Crisp Helpdesk. Am I supposed to set any specific configuration to be able to do it?

valeriansaliou commented 5 years ago

Hello! That's quite normal, as Sonic does not search by end-of-word. It's quite able to correct a mistyped end-of-word if the word is long-enough, as the Levenshtein distance that's allowed is higher (ie. mistaken characters, removed, added or different).

The word "search" is not long-enough to be corrected, thus Sonic does not find anything for "earch" as it does not allow any mistake to be made to enable the fuzzy-searching mode.

That's why. With Crisp Helpdesk, we use a fallback super-fuzzy search from a crossed MySQL database, with a simple WHERE LIKE %word%

ghost commented 5 years ago

Hi! Sorry for not responding earlier, I have been very busy these past days. Thank you for your answer. To be honest I found that recently on one of the closed issues of the repository so I implemented something similar so it adapted to the needs I have. Thank you again.