lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "G.Long" <jde...@gmail.com>
Subject fuzzy query on phrases
Date Mon, 08 Apr 2013 16:18:33 GMT
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message