lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Konidena <deepak.konid...@cornell.edu>
Subject Using Fuzzysearch with MultiFieldQueryParser
Date Thu, 24 Mar 2011 17:48:40 GMT
Hi,

I am using MultiFieldQueryParser with a custom analyzer for parsing search text.

Now,  when I say

MultiFieldQueryParser qp = new MultiFieldQueryParser(Version,  new String[] {"field1", "field2",
"field3"}, customAnalyzer);
qp.setDefaultOperator(QueryParser.AND_OPERATOR);

Query query = qp.parse("term1");

The query that gets built is

field1:term1 field2:term1 field3:term1

I am assuming input is treated as a TermQuery and is being searched against the respective
fields (field1, field2, field3) in case of single term and in case of multiple search terms,
a BooleanQuery with an AND of all the individual TermQueries.

Now what if  I want to do something like,

Perform a TermQuery on term1 against all the fields, perform a FuzzyQuery on term2, RangeQuery
on term3, etc..

And finally do an AND on all the terms?

Please let me know, if am assuming anything wrong here. My understanding is that to break
individual terms to be searched using different queries, I will need to implement a custom
QueryParser. If so, how would I start about implementing that?


Thanks
Deepak Konidena




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message