public class BooleanQuery extends Query implements java.lang.Iterable<BooleanClause>
TermQuery
s, PhraseQuery
s 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 boolean |
disableCoord |
private int |
hashCode |
private static int |
maxClauseCount |
private int |
minimumNumberShouldMatch |
Modifier | Constructor and Description |
---|---|
private |
BooleanQuery(boolean disableCoord,
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,
boolean needsScores)
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.
|
boolean |
isCoordDisabled()
Return whether the coord factor is disabled.
|
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.
|
classHash, sameClassAs, toString
private static int maxClauseCount
private final boolean disableCoord
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(boolean disableCoord, int minimumNumberShouldMatch, BooleanClause[] clauses)
public static int getMaxClauseCount()
BooleanQuery.TooManyClauses
to be thrown.setMaxClauseCount(int)
public static void setMaxClauseCount(int maxClauseCount)
public boolean isCoordDisabled()
public int getMinimumNumberShouldMatch()
public java.util.List<BooleanClause> clauses()
BooleanQuery
.java.util.Collection<Query> getClauses(BooleanClause.Occur occur)
BooleanClause.Occur
.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, boolean needsScores) throws java.io.IOException
Query
Only implemented by primitive queries, which re-write to themselves.
createWeight
in class Query
needsScores
- True if document scores (Scorer.score()
) or match
frequencies (Scorer.freq()
) are needed.java.io.IOException
public Query rewrite(IndexReader reader) throws java.io.IOException
Query
public java.lang.String toString(java.lang.String field)
public boolean equals(java.lang.Object o)
BooleanQuery
,isCoordDisabled()
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 Query
Query.sameClassAs(Object)
,
Query.classHash()
private boolean equalsTo(BooleanQuery other)
private int computeHashCode()
public int hashCode()
Query
QueryCache
works properly.hashCode
in class Query
Query.equals(Object)