public class BooleanQuery extends Query implements 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 | 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, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic 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
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.IOExceptionpublic Query rewrite(IndexReader reader) throws IOException
QueryCallers are expected to call rewrite multiple times if necessary, until the
rewritten query is the same as the original query.
rewrite in class QueryIOExceptionIndexSearcher.rewrite(Query)public void visit(QueryVisitor visitor)
Querypublic 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 QueryQuery.sameClassAs(Object),
Query.classHash()public int hashCode()
QueryQueryCache works properly.hashCode in class QueryQuery.equals(Object)Copyright © 2000-2024 Apache Software Foundation. All Rights Reserved.