Rakesh Chaudhari
Rakesh Chaudhari

Reputation: 3510

How to search phonetic misspelled word in Lucene?

Here is the Scenario of Lucene Searching,

In Lucene document contains two fields having values "Red" and "Red Feather".

I want to search Red Feathar.

It is returning "Red" as first result. But I want "Red Feather" as first result.

I tried using fuzzy query term matches. but its makes my application slow.

So is there any another way to search Phonetic misspelled word in Lucene?

Thanks,

Upvotes: 0

Views: 1037

Answers (1)

femtoRgon
femtoRgon

Reputation: 33351

There are Phonetic matching methods in Lucene, but I think a FuzzyQuery is the right choice for this case. There are a few ways to enhance it's performance:

  • Are you using Lucene 4.0 or later? FuzzyQuery performance got a huge boost in 4.0.

  • Set a prefixLength. This forces the first x characters to directly match, which narrows searching for matching terms significantly, and takes better advantage of lucene's indexing methods, leading to significantly improved performance.

  • If you are using 3.6 or earlier (and can't switch to a more recent version), make sure you set minimumSimilarity

  • If you are using 4.0 or later, you could try setting maxEdits to 1

Upvotes: 1

Related Questions