lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trejkaz <>
Subject Re: MultiFieldQueryParser with default AND and stopfilter
Date Wed, 08 Jun 2011 21:32:09 GMT
On Wed, Jun 8, 2011 at 6:52 PM, Elmer <> wrote:
> the parsed query becomes:
> '+(title:the) +(title:project desc:project)'.
> So, the problem is that docs that have the term 'the' only appearing in
> their desc field are excluded from the results.

Subclass MFQP and override getFieldQuery.

If the field is null then MFQP will hand you back a BooleanQuery - if
the number of terms in this is lower than the number of fields then
some of them must have been removed because they were stop words.  If
this occurs, replace the whole BooleanQuery with a MatchAllDocsQuery.

Then you will effectively get:

    +(*:*) +(title:project desc:project)

And then in getBooleanQuery you could optimise the query to take out
MatchAllDocsQuery if it isn't necessary in a boolean query.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message