Fuzzy search for a group of words / multiple terms

I need to do fuzzy searches for a group of words (and not just single terms).

My database table has many rows containing 1 or more words, and I need to find the best match for the group of words I am looking for.

eg:

I am looking for "pommes de terre" , it should give "pomme de terre" , and with the lower score "pomme" "terre" or any possible matching term.

For individual terms, it works fine, corrects common and severe errors. But if I'm looking for a lot of terms, individual terms have better grades than exact matches, and a group of words:

Search: "pomme de terre"

  • poire, rating: 2.3862941
  • pomme, rating: 2.2527628
  • pomme de terre , estimate: 1.1263814 <- Not high enough

Question

Is there a solution that gives a better result, the more matches match? (the more fuzzy matches, the more points)

Settings

Search query:

{query: {fuzzy_like_this: { like_text: 'pomme de terre'} } } 

Settings:

 :analysis => { :analyzer => { :folding => { :tokenizer => "icu_tokenizer", :filter => [ "icu_folding"] } } } 

I am new to using elasticsearch-rails. I tried using the suggested queries, but they are not suitable for use with rails gem.

I must clarify that this search is a big part of my project ...

+7
elasticsearch
source share
1 answer

I ran into the same problem. Here is 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); 
0
source share

All Articles