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. |
Constructor and Description |
---|
BooleanQuery()
Deprecated.
Use the
BooleanQuery.Builder class to build boolean queries. |
BooleanQuery(boolean disableCoord)
Deprecated.
Use the
BooleanQuery.Builder class to build boolean queries. |
Modifier and Type | Method and Description |
---|---|
void |
add(BooleanClause clause)
Deprecated.
Boolean queries should be created once with
BooleanQuery.Builder
and then considered immutable. See BooleanQuery.Builder.add(org.apache.lucene.search.BooleanClause) . |
void |
add(Query query,
BooleanClause.Occur occur)
Deprecated.
Boolean queries should be created once with
BooleanQuery.Builder
and then considered immutable. See BooleanQuery.Builder.add(org.apache.lucene.search.BooleanClause) . |
List<BooleanClause> |
clauses()
Return a list of the clauses of this
BooleanQuery . |
BooleanQuery |
clone()
Returns a clone of this query.
|
Weight |
createWeight(IndexSearcher searcher,
boolean needsScores)
Expert: Constructs an appropriate Weight implementation for this query.
|
boolean |
equals(Object o) |
BooleanClause[] |
getClauses()
Deprecated.
Use
clauses() . |
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() |
boolean |
isCoordDisabled()
Return whether the coord factor is disabled.
|
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.
|
void |
setMinimumNumberShouldMatch(int min)
Deprecated.
Boolean queries should be created once with
BooleanQuery.Builder
and then considered immutable. See BooleanQuery.Builder.setMinimumNumberShouldMatch(int) . |
String |
toString(String field)
Prints a user-readable version of this query.
|
@Deprecated public BooleanQuery()
BooleanQuery.Builder
class to build boolean queries.@Deprecated public BooleanQuery(boolean disableCoord)
BooleanQuery.Builder
class to build boolean queries.Similarity.coord(int,int)
may be disabled in scoring, as
appropriate. For example, this score factor does not make sense for most
automatically generated queries, like WildcardQuery
and FuzzyQuery
.disableCoord
- disables Similarity.coord(int,int)
in scoring.BooleanQuery.Builder.setDisableCoord(boolean)
public static int getMaxClauseCount()
BooleanQuery.TooManyClauses
to be thrown.setMaxClauseCount(int)
public static void setMaxClauseCount(int maxClauseCount)
public boolean isCoordDisabled()
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, boolean needsScores) throws 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.IOException
public Query rewrite(IndexReader reader) throws IOException
Query
rewrite
in class Query
IOException
@Deprecated public BooleanClause[] getClauses()
clauses()
.public BooleanQuery clone()
Query
@Deprecated public void setMinimumNumberShouldMatch(int min)
BooleanQuery.Builder
and then considered immutable. See BooleanQuery.Builder.setMinimumNumberShouldMatch(int)
.getMinimumNumberShouldMatch()
@Deprecated public void add(Query query, BooleanClause.Occur occur)
BooleanQuery.Builder
and then considered immutable. See BooleanQuery.Builder.add(org.apache.lucene.search.BooleanClause)
.BooleanQuery.TooManyClauses
- if the new number of clauses exceeds the maximum clause numbergetMaxClauseCount()
@Deprecated public void add(BooleanClause clause)
BooleanQuery.Builder
and then considered immutable. See BooleanQuery.Builder.add(org.apache.lucene.search.BooleanClause)
.BooleanQuery.TooManyClauses
- if the new number of clauses exceeds the maximum clause numbergetMaxClauseCount()
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.