public class BooleanQuery extends Query implements java.lang.Iterable<BooleanClause>
TermQuerys, PhraseQuerys or other
BooleanQuerys.| Modifier and Type | Class and Description |
|---|---|
static class |
BooleanQuery.Builder
A builder for boolean queries.
|
static class |
BooleanQuery.TooManyClauses
Thrown when an attempt is made to add more than
getMaxClauseCount() clauses. |
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<BooleanClause> |
clauses |
private java.util.Map<BooleanClause.Occur,java.util.Collection<Query>> |
clauseSets |
private int |
hashCode |
private static int |
maxClauseCount |
private int |
minimumNumberShouldMatch |
| Modifier | Constructor and Description |
|---|---|
private |
BooleanQuery(int minimumNumberShouldMatch,
BooleanClause[] clauses) |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<BooleanClause> |
clauses()
Return a list of the clauses of this
BooleanQuery. |
private int |
computeHashCode() |
Weight |
createWeight(IndexSearcher searcher,
ScoreMode scoreMode,
float boost)
Expert: Constructs an appropriate Weight implementation for this query.
|
boolean |
equals(java.lang.Object o)
Compares the specified object with this boolean query for equality.
|
private boolean |
equalsTo(BooleanQuery other) |
(package private) java.util.Collection<Query> |
getClauses(BooleanClause.Occur occur)
Return the collection of queries for the given
BooleanClause.Occur. |
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 satisfied.
|
int |
hashCode()
Override and implement query hash code properly in a subclass.
|
(package private) boolean |
isPureDisjunction()
Whether this query is a pure disjunction, ie.
|
java.util.Iterator<BooleanClause> |
iterator()
Returns an iterator on the clauses in this query.
|
Query |
rewrite(IndexReader reader)
Expert: called to re-write queries into primitive queries.
|
private BooleanQuery |
rewriteNoScoring() |
static void |
setMaxClauseCount(int maxClauseCount)
Set the maximum number of clauses permitted per BooleanQuery.
|
java.lang.String |
toString(java.lang.String field)
Prints a user-readable version of this query.
|
void |
visit(QueryVisitor visitor)
Recurse through the query tree, visiting any child queries
|
classHash, sameClassAs, toStringprivate static int maxClauseCount
private final int minimumNumberShouldMatch
private final java.util.List<BooleanClause> clauses
private final java.util.Map<BooleanClause.Occur,java.util.Collection<Query>> clauseSets
private int hashCode
private BooleanQuery(int minimumNumberShouldMatch,
BooleanClause[] clauses)
public static int getMaxClauseCount()
BooleanQuery.TooManyClauses to be thrown.setMaxClauseCount(int)public static void setMaxClauseCount(int maxClauseCount)
public int getMinimumNumberShouldMatch()
public java.util.List<BooleanClause> clauses()
BooleanQuery.java.util.Collection<Query> getClauses(BooleanClause.Occur occur)
BooleanClause.Occur.boolean isPureDisjunction()
public final java.util.Iterator<BooleanClause> iterator()
Iterable interface to
make it possible to do:
for (BooleanClause clause : booleanQuery) {}iterator in interface java.lang.Iterable<BooleanClause>private BooleanQuery rewriteNoScoring()
public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws java.io.IOException
QueryOnly implemented by primitive queries, which re-write to themselves.
createWeight in class QueryscoreMode - How the produced scorers will be consumed.boost - The boost that is propagated by the parent queries.java.io.IOExceptionpublic Query rewrite(IndexReader reader) throws java.io.IOException
Querypublic void visit(QueryVisitor visitor)
Querypublic java.lang.String toString(java.lang.String field)
public boolean equals(java.lang.Object o)
BooleanQuery,getMinimumNumberShouldMatch()BooleanClause.Occur.SHOULD clauses, regardless of the orderBooleanClause.Occur.MUST clauses, regardless of the orderBooleanClause.Occur.FILTER clauses, regardless of the
order and regardless of duplicatesBooleanClause.Occur.MUST_NOT clauses, regardless of
the order and regardless of duplicatesequals in class QueryQuery.sameClassAs(Object),
Query.classHash()private boolean equalsTo(BooleanQuery other)
private int computeHashCode()
public int hashCode()
QueryQueryCache works properly.hashCode in class QueryQuery.equals(Object)