org.apache.lucene.search
public class BooleanQuery extends Query
Nested Class Summary | |
---|---|
static class | BooleanQuery.TooManyClauses Thrown when an attempt is made to add more than TooManyClauses clauses. |
Field Summary | |
---|---|
static int | maxClauseCount |
protected int | minNrShouldMatch |
Constructor Summary | |
---|---|
BooleanQuery() Constructs an empty boolean query. | |
BooleanQuery(boolean disableCoord) Constructs an empty boolean query.
Similarity may be disabled in scoring, as
appropriate. |
Method Summary | |
---|---|
void | add(Query query, boolean required, boolean prohibited) Adds a clause to a boolean query. |
void | add(Query query, BooleanClause.Occur occur) Adds a clause to a boolean query.
|
void | add(BooleanClause clause) Adds a clause to a boolean query. |
Object | clone() |
protected Weight | createWeight(Searcher searcher) |
boolean | equals(Object o) Returns true iff o is equal to this. |
void | extractTerms(Set terms) |
BooleanClause[] | getClauses() Returns the set of clauses in this query. |
static int | getMaxClauseCount() Return the maximum number of clauses permitted, 1024 by default.
|
int | getMinimumNumberShouldMatch()
Gets the minimum number of the optional BooleanClauses
which must be satisifed. |
Similarity | getSimilarity(Searcher searcher) |
static boolean | getUseScorer14() |
int | hashCode() Returns a hash code value for this object. |
boolean | isCoordDisabled() Returns true iff Similarity is disabled in
scoring for this query instance. |
Query | rewrite(IndexReader reader) |
static void | setMaxClauseCount(int maxClauseCount) Set the maximum number of clauses permitted per BooleanQuery.
|
void | setMinimumNumberShouldMatch(int min)
Specifies a minimum number of the optional BooleanClauses
which must be satisifed.
|
static void | setUseScorer14(boolean use14) |
String | toString(String field) Prints a user-readable version of this query. |
Deprecated: use BooleanQuery instead
Parameters: disableCoord disables Similarity in scoring.
Deprecated: use BooleanQuery instead:
required
which means that documents which do not
match this sub-query will not match the boolean query;
prohibited
which means that documents which do
match this sub-query will not match the boolean query; or
required
and
prohibited
.
Throws: TooManyClauses if the new number of clauses exceeds the maximum clause number
See Also: getMaxClauseCount
Throws: TooManyClauses if the new number of clauses exceeds the maximum clause number
See Also: getMaxClauseCount
o
is equal to this.See Also: BooleanQuery
See Also: BooleanQuery
TermQuery clauses are generated from for example prefix queries and fuzzy queries. Each TermQuery needs some buffer space during search, so this parameter indirectly controls the maximum buffer requirements for query search.
When this parameter becomes a bottleneck for a Query one can use a Filter. For example instead of a RangeQuery one can use a RangeFilter.
Normally the buffers are allocated by the JVM. When using for example MMapDirectory the buffering is left to the operating system.
By default no optional clauses are neccessary for a match (unless there are no required clauses). If this method is used, then the specified numebr of clauses is required.
Use of this method is totally independant 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 will force the use of BooleanWeight2, regardless of wether setUseScorer14(true) has been called.
Parameters: min the number of optional clauses that must match
See Also: BooleanQuery