gate.creole.annic.apache.lucene.search
Class BooleanQuery

java.lang.Object
  extended by gate.creole.annic.apache.lucene.search.Query
      extended by gate.creole.annic.apache.lucene.search.BooleanQuery
All Implemented Interfaces:
Serializable, Cloneable

public class BooleanQuery
extends Query

A Query that matches documents matching boolean combinations of other queries, typically TermQuerys or PhraseQuerys.

See Also:
Serialized Form

Nested Class Summary
static class BooleanQuery.TooManyClauses
          Thrown when an attempt is made to add more than getMaxClauseCount() clauses.
 
Field Summary
static int maxClauseCount
          Default value is 1024.
 
Constructor Summary
BooleanQuery()
          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)
          Adds a clause to a boolean query.
 Object clone()
          Returns a clone of this query.
protected  Weight createWeight(Searcher searcher)
          Expert: Constructs an appropriate Weight implementation for this query.
 boolean equals(Object o)
          Returns true iff o is equal to this.
 BooleanClause[] getClauses()
          Returns the set of clauses in this query.
static int getMaxClauseCount()
          Return the maximum number of clauses permitted, 1024 by default.
 int hashCode()
          Returns a hash code value for this object.
 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.
 String toString(String field)
          Prints a user-readable version of this query.
 
Methods inherited from class gate.creole.annic.apache.lucene.search.Query
combine, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

maxClauseCount

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

Constructor Detail

BooleanQuery

public BooleanQuery()
Constructs an empty boolean query.

Method Detail

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 BooleanQuery.TooManyClauses to be thrown.


setMaxClauseCount

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


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()

getClauses

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


createWeight

protected Weight createWeight(Searcher searcher)
Description copied from class: Query
Expert: Constructs an appropriate Weight implementation for this query.

Only implemented by primitive queries, which re-write to themselves.

Overrides:
createWeight in class Query

rewrite

public Query rewrite(IndexReader reader)
              throws IOException
Description copied from class: Query
Expert: called to re-write queries into primitive queries.

Overrides:
rewrite in class Query
Throws:
IOException

clone

public Object clone()
Description copied from class: Query
Returns a clone of this query.

Overrides:
clone in class Query

toString

public String toString(String field)
Prints a user-readable version of this query.

Specified by:
toString in class Query

equals

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

Overrides:
equals in class Object

hashCode

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

Overrides:
hashCode in class Object