fuzzy query on phrases

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

fuzzy query on phrases

G.Long
Hi :)

I'm using Lucene 3.1 and I would like to use fuzzy query on a field
which contains the title of my document. This field is indexed and
stored using the standard analyzer.

I found the ComplexPhraseQueryParser class which seems to support fuzzy
option. Here is the code I'm using to create my query:

ComplexPhraseQueryParser parser = new
ComplexPhraseQueryParser(Version.LUCENE_31, "title", new
StandardAnalyzer(Version.LUCENE_31));
parser.setFuzzyMinSim(new Float(0.8));
Query queryElmt = parser.parse("the title to find");
query.add(queryElmt, Occur.MUST);

The boolean query at the end is for other fields with mandatory values.

The problem is the generated query is:

+(title:the title:title title:to title:find)

There is no sign of the fuzzy attribute (~0.8). Did I do something wrong?

ps: I know I can create a FuzzyQuery for each word of the title and add
them all to the boolean query. This works find but it is slow and I need
to do a lot of queries like this one.

Thank you :)
Gary







---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]