Hi Shahak,

BooleanQuery.setMinimumNumberShouldMatch might help you here.

Alan Woodward
www.flax.co.uk


On 18 Nov 2013, at 18:35, Shahak Nagiel wrote:

> Initially, I queried our (v4.4) index with a single MultiFieldQueryParser and 
> Operator.AND to ensure that all search terms appeared in the results.
> 
> Since then, however, we've needed to query more flexibly, using a 
> BooleanQuery to merge several subqueries (in order to apply different 
> analyzers to different fields/field groups).  As a result, we've had to 
> switch to Operator.OR, since there was no guarantee that all search terms 
> would apply to/match every clause of the boolean query.
> 
> Consequently, there's more "noise" in the returned results, since many of 
> them don't contain ALL the original search terms.
> 
> So, is there a way to enforce this AND/MUST policy in a cumulative sense 
> across all subqueries (i.e. filter out results which don't match all search 
> terms)?
> 
> Thanks!

Reply via email to