org.compass.core
Interface CompassQueryBuilder.CompassBooleanQueryBuilder

All Superinterfaces:
CompassQueryBuilder.ToCompassQuery
All Known Implementing Classes:
DefaultCompassQueryBuilder.DefaultCompassBooleanQueryBuilder
Enclosing interface:
CompassQueryBuilder

public static interface CompassQueryBuilder.CompassBooleanQueryBuilder
extends CompassQueryBuilder.ToCompassQuery

A boolean query builder. Used to construct query that will return hits that are the matching boolean combinations of other queries.

Author:
kimchy

Method Summary
 CompassQueryBuilder.CompassBooleanQueryBuilder addMust(CompassQuery query)
          Hits must match the given query.
 CompassQueryBuilder.CompassBooleanQueryBuilder addMustNot(CompassQuery query)
          Hits must not match the given query.
 CompassQueryBuilder.CompassBooleanQueryBuilder addShould(CompassQuery query)
          Hits should match the given query.
 CompassQueryBuilder.CompassBooleanQueryBuilder setMinimumNumberShouldMatch(int min)
          Specifies a minimum number of the optional BooleanClauses which must be satisfied.
 
Methods inherited from interface org.compass.core.CompassQueryBuilder.ToCompassQuery
toQuery
 

Method Detail

addMust

CompassQueryBuilder.CompassBooleanQueryBuilder addMust(CompassQuery query)
Hits must match the given query.

Parameters:
query - The query to add
Returns:
The current builder

addMustNot

CompassQueryBuilder.CompassBooleanQueryBuilder addMustNot(CompassQuery query)
Hits must not match the given query. Note that it is not possible to build a boolean query that only consists of must not queries.

Parameters:
query - The query to add
Returns:
The current builder

addShould

CompassQueryBuilder.CompassBooleanQueryBuilder addShould(CompassQuery query)
Hits should match the given query. For a boolean build query with two should subqueries, at least one of the queries must appear in the matching hits.

Parameters:
query - The query to add
Returns:
The current builder

setMinimumNumberShouldMatch

CompassQueryBuilder.CompassBooleanQueryBuilder setMinimumNumberShouldMatch(int min)
Specifies a minimum number of the optional BooleanClauses which must be satisfied.

By default no optional clauses are necessary for a match (unless there are no required clauses). If this method is used, then the specified number of clauses is required.

Use of this method is totally independent of specifying that any specific clauses are required (or prohibited). This number will only be compared against the number of matching optional clauses.

EXPERT NOTE: Using this method may force collecting docs in order, regardless of whether setAllowDocsOutOfOrder(true) has been called.



Copyright (c) 2004-2008 The Compass Project.