org.apache.lucene.search

Class BooleanQuery

public class BooleanQuery extends Query

A Query that matches documents matching boolean combinations of other queries, typically {@link TermQuery}s or {@link PhraseQuery}s.
Nested Class Summary
static classBooleanQuery.TooManyClauses
Thrown when an attempt is made to add more than {@link #getMaxClauseCount()} clauses.
Field Summary
static intmaxClauseCount
Default value is 1024.
Constructor Summary
BooleanQuery()
Constructs an empty boolean query.
Method Summary
voidadd(Query query, boolean required, boolean prohibited)
Adds a clause to a boolean query.
voidadd(BooleanClause clause)
Adds a clause to a boolean query.
Objectclone()
protected WeightcreateWeight(Searcher searcher)
booleanequals(Object o)
Returns true iff o is equal to this.
BooleanClause[]getClauses()
Returns the set of clauses in this query.
static intgetMaxClauseCount()
Return the maximum number of clauses permitted, 1024 by default.
inthashCode()
Returns a hash code value for this object.
Queryrewrite(IndexReader reader)
static voidsetMaxClauseCount(int maxClauseCount)
Set the maximum number of clauses permitted.
StringtoString(String field)
Prints a user-readable version of this query.

Field Detail

maxClauseCount

public static int maxClauseCount
Default value is 1024. Use org.apache.lucene.maxClauseCount system property to override.

Constructor Detail

BooleanQuery

public BooleanQuery()
Constructs an empty boolean query.

Method Detail

add

public void add(Query query, boolean required, boolean prohibited)
Adds a clause to a boolean query. Clauses may be: It is an error to specify a clause as both required and prohibited.

See Also: getMaxClauseCount

add

public void add(BooleanClause clause)
Adds a clause to a boolean query.

See Also: getMaxClauseCount

clone

public Object clone()

createWeight

protected Weight createWeight(Searcher searcher)

equals

public boolean equals(Object o)
Returns true iff o is equal to this.

getClauses

public BooleanClause[] getClauses()
Returns the set of clauses in this query.

getMaxClauseCount

public static int getMaxClauseCount()
Return the maximum number of clauses permitted, 1024 by default. Attempts to add more than the permitted number of clauses cause {@link TooManyClauses} to be thrown.

hashCode

public int hashCode()
Returns a hash code value for this object.

rewrite

public Query rewrite(IndexReader reader)

setMaxClauseCount

public static void setMaxClauseCount(int maxClauseCount)
Set the maximum number of clauses permitted.

toString

public String toString(String field)
Prints a user-readable version of this query.
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.