I need to make fuzzy searches on group of words (and not only single terms).
My database table have many strings, containing 1 or more words, and I need to find the best fit for a searched group of words.
I search "pommes de terre", it should give "pomme de terre", and with inferior score, "pomme", "terre", or any possible matching term.
For single terms, it works perfectly, and corrects typoes, and heavy mistakes. But if I search for many terms, single terms have better scores than exact matches, and group of words:
Is there a solution which gives a better score the more terms matches ? (the more fuzzy terms matches, the more score is high)
Search Query:
{query:
{fuzzy_like_this:
{ like_text: 'pomme de terre'}
}
}
Settings:
:analysis => {
:analyzer => {
:folding => {
:tokenizer => "icu_tokenizer",
:filter => [ "icu_folding"]
}
}
}
I'm a beginner, using elasticsearch-rails. I tried to use suggest queries, but they are not usable with rails gem.
I have to precise that this search is a big part of my project...
I had the same issue, and came to the conclusion that fuzzy query is not what I needed.
Fuzzy queries are term-level queries. I got much better results with a match query, which you can apply fuzziness on thanks to the fuzziness
param.
I faced the same issue. Here's how I fixed it using Java-8 and ES-1.7.
QueryBuilders.multiMatchQuery("pommes de terre","name")
.fuzziness(3)
.minimumShouldMatch("90%")
.type(Type.MOST_FIELDS);
Note: minimumShouldMatch is what does the trick here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With