Lucene Fuzzy Match on a phrase instead of a single word

I'm trying to make a fuzzy match on the phrase "Grand Prarie" (intentionally wrong) using Apache Lucene. Part of my problem is that the operator ~only performs fuzzy matches on one word of the words and behaves like a matching match for phrases.

Is there a way to make a fuzzy phrase match with lucene?

+5
source share
3 answers

Lucene 3.0 has a ComplexPhraseQueryParser that supports fuzzy phrase queries. This is in the contrib package.

+5
source

, , MultiPhraseQuery. :

<MultiPhraseQuery: "grand (prarie prairie)">
+2

Came through Google and felt the solutions where not what I needed. In my case, the solution was to simply repeat the search sequence against the solr API. For example, if I were looking for: title_t to include a match for "dog ~" and "cat ~", I added some manual code to generate a request like:

((title_t:dog~) and (title_t:cat~))

It may be just what is written above, but the links seem to be dead.

+1
source

All Articles