|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.lucene.search.Query
org.apache.lucene.search.BooleanQuery
A Query that matches documents matching boolean combinations of other
queries, e.g. TermQuerys, PhraseQuerys or other
BooleanQuerys.
| Nested Class Summary | |
static class |
BooleanQuery.TooManyClauses
Thrown when an attempt is made to add more than getMaxClauseCount() clauses. |
| Field Summary | |
static int |
maxClauseCount
Deprecated. use setMaxClauseCount(int) instead |
protected int |
minNrShouldMatch
|
| Constructor Summary | |
BooleanQuery()
Constructs an empty boolean query. |
|
BooleanQuery(boolean disableCoord)
Constructs an empty boolean query. |
|
| Method Summary | |
void |
add(BooleanClause clause)
Adds a clause to a boolean query. |
void |
add(Query query,
boolean required,
boolean prohibited)
Deprecated. use add(Query, BooleanClause.Occur) instead:
|
void |
add(Query query,
BooleanClause.Occur occur)
Adds a clause to a boolean query. |
java.lang.Object |
clone()
Returns a clone of this query. |
protected Weight |
createWeight(Searcher searcher)
Expert: Constructs an appropriate Weight implementation for this query. |
boolean |
equals(java.lang.Object o)
Returns true iff o is equal to this. |
void |
extractTerms(java.util.Set terms)
Expert: adds all terms occuring in this query to the terms set. |
BooleanClause[] |
getClauses()
Returns the set of clauses in this query. |
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 satisifed. |
Similarity |
getSimilarity(Searcher searcher)
Expert: Returns the Similarity implementation to be used for this query. |
static boolean |
getUseScorer14()
|
int |
hashCode()
Returns a hash code value for this object. |
boolean |
isCoordDisabled()
Returns true iff Similarity.coord(int,int) is disabled in
scoring for this query instance. |
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)
Specifies a minimum number of the optional BooleanClauses which must be satisifed. |
static void |
setUseScorer14(boolean use14)
|
java.lang.String |
toString(java.lang.String field)
Prints a user-readable version of this query. |
| Methods inherited from class org.apache.lucene.search.Query |
combine, getBoost, mergeBooleanQueries, setBoost, toString, weight |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static int maxClauseCount
setMaxClauseCount(int) instead
protected int minNrShouldMatch
| Constructor Detail |
public BooleanQuery()
public BooleanQuery(boolean disableCoord)
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.| Method Detail |
public static int getMaxClauseCount()
BooleanQuery.TooManyClauses to be thrown.
setMaxClauseCount(int)public static void setMaxClauseCount(int maxClauseCount)
TermQuery clauses are generated from for example prefix queries and fuzzy queries. Each TermQuery needs some buffer space during search, so this parameter indirectly controls the maximum buffer requirements for query search.
When this parameter becomes a bottleneck for a Query one can use a
Filter. For example instead of a RangeQuery one can use a
RangeFilter.
Normally the buffers are allocated by the JVM. When using for example
MMapDirectory the buffering is left to
the operating system.
public boolean isCoordDisabled()
Similarity.coord(int,int) is disabled in
scoring for this query instance.
BooleanQuery(boolean)public Similarity getSimilarity(Searcher searcher)
Query
getSimilarity in class Querypublic void setMinimumNumberShouldMatch(int min)
By default no optional clauses are neccessary for a match (unless there are no required clauses). If this method is used, then the specified numebr of clauses is required.
Use of this method is totally independant of specifying that any specific clauses are required (or prohibited). This number will only be compared against the number of matching optional clauses.
EXPERT NOTE: Using this method will force the use of BooleanWeight2, regardless of wether setUseScorer14(true) has been called.
min - the number of optional clauses that must matchsetUseScorer14(boolean)public int getMinimumNumberShouldMatch()
public void add(Query query,
boolean required,
boolean prohibited)
add(Query, BooleanClause.Occur) instead:
required which means that documents which do not
match this sub-query will not match the boolean query;
prohibited which means that documents which do
match this sub-query will not match the boolean query; or
required and
prohibited.
public void add(Query query,
BooleanClause.Occur occur)
BooleanQuery.TooManyClauses - if the new number of clauses exceeds the maximum clause numbergetMaxClauseCount()public void add(BooleanClause clause)
BooleanQuery.TooManyClauses - if the new number of clauses exceeds the maximum clause numbergetMaxClauseCount()public BooleanClause[] getClauses()
public static void setUseScorer14(boolean use14)
public static boolean getUseScorer14()
protected Weight createWeight(Searcher searcher)
throws java.io.IOException
QueryOnly implemented by primitive queries, which re-write to themselves.
createWeight in class Queryjava.io.IOException
public Query rewrite(IndexReader reader)
throws java.io.IOException
Query
rewrite in class Queryjava.io.IOExceptionpublic void extractTerms(java.util.Set terms)
Queryrewritten form.
extractTerms in class Querypublic java.lang.Object clone()
Query
clone in class Querypublic java.lang.String toString(java.lang.String field)
toString in class Querypublic boolean equals(java.lang.Object o)
o is equal to this.
public int hashCode()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||