public class BooleanQuery extends Query implements 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 | Method and Description |
---|---|
List<BooleanClause> |
clauses()
Return a list of the clauses of this
BooleanQuery . |
Weight |
createWeight(IndexSearcher searcher,
ScoreMode scoreMode,
float boost)
Expert: Constructs an appropriate Weight implementation for this query.
|
boolean |
equals(Object o)
Compares the specified object with this boolean query for equality.
|
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.
|
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.
|
static void |
setMaxClauseCount(int maxClauseCount)
Set the maximum number of clauses permitted per BooleanQuery.
|
String |
toString(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, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static int getMaxClauseCount()
BooleanQuery.TooManyClauses
to be thrown.setMaxClauseCount(int)
public static void setMaxClauseCount(int maxClauseCount)
public int getMinimumNumberShouldMatch()
public List<BooleanClause> clauses()
BooleanQuery
.public final Iterator<BooleanClause> iterator()
Iterable
interface to
make it possible to do:
for (BooleanClause clause : booleanQuery) {}
iterator
in interface Iterable<BooleanClause>
public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException
Query
Only implemented by primitive queries, which re-write to themselves.
createWeight
in class Query
scoreMode
- How the produced scorers will be consumed.boost
- The boost that is propagated by the parent queries.IOException
public Query rewrite(IndexReader reader) throws IOException
Query
rewrite
in class Query
IOException
public void visit(QueryVisitor visitor)
Query
public boolean equals(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 Query
Query.sameClassAs(Object)
,
Query.classHash()
public int hashCode()
Query
QueryCache
works properly.hashCode
in class Query
Query.equals(Object)
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.