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);

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?

Deepak Konidena

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 3 | next ›
Discussion Overview
groupjava-user @
postedMar 24, '11 at 5:49p
activeMar 25, '11 at 2:19p

2 users in discussion

Deepak Konidena: 2 posts Ian Lea: 1 post



site design / logo © 2022 Grokbase