org.apache.lucene.search
Class BooleanQuery
- Cloneable, Serializable
public class BooleanQuery
A Query that matches documents matching boolean combinations of other
queries, e.g.
TermQuery
s,
PhraseQuery
s or other
BooleanQuerys.
clone , combine , createWeight , extractTerms , getBoost , getSimilarity , mergeBooleanQueries , rewrite , setBoost , toString , toString , weight |
minNrShouldMatch
protected int minNrShouldMatch
BooleanQuery
public BooleanQuery()
Constructs an empty boolean query.
BooleanQuery
public BooleanQuery(boolean disableCoord)
add
public void add(BooleanClause clause)
Adds a clause to a boolean query.
clauses
public List clauses()
Returns the list of clauses in this query.
clone
public Object clone()
- clone in interface Query
equals
public boolean equals(Object o)
Returns true iff o
is equal to this.
getClauses
public BooleanClause[] getClauses()
Returns the set of clauses in this query.
getMaxClauseCount
public static int getMaxClauseCount()
Return the maximum number of clauses permitted, 1024 by default.
Attempts to add more than the permitted number of clauses cause
BooleanQuery.TooManyClauses
to be thrown.
getMinimumNumberShouldMatch
public int getMinimumNumberShouldMatch()
Gets the minimum number of the optional BooleanClauses
which must be satisifed.
getUseScorer14
public static boolean getUseScorer14()
hashCode
public int hashCode()
Returns a hash code value for this object.
isCoordDisabled
public boolean isCoordDisabled()
setMaxClauseCount
public static void setMaxClauseCount(int maxClauseCount)
Set the maximum number of clauses permitted per BooleanQuery.
Default value is 1024.
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.
setMinimumNumberShouldMatch
public void setMinimumNumberShouldMatch(int min)
Specifies a minimum number of the optional BooleanClauses
which must be satisifed.
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.
min
- the number of optional clauses that must match
setUseScorer14
public static void setUseScorer14(boolean use14)
toString
public String toString(String field)
Prints a user-readable version of this query.
- toString in interface Query
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.