com.lucene.search
Class BooleanQuery
java.lang.Object
|
+--com.lucene.search.Query
|
+--com.lucene.search.BooleanQuery
- public final class BooleanQuery
- extends Query
A Query that matches documents matching boolean combinations of other
queries, typically TermQuery
s or PhraseQuery
s.
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. |
String |
toString(String field)
Prints a user-readable version of this query. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BooleanQuery
public BooleanQuery()
- Constructs an empty boolean query.
add
public final void add(Query query,
boolean required,
boolean prohibited)
- Adds a clause to a boolean query. Clauses may be:
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
- neither, in which case matched documents are neither prohibited from
nor required to match the sub-query.
It is an error to specify a clause as both required
and
prohibited
.
add
public final void add(BooleanClause clause)
- Adds a clause to a boolean query.
toString
public String toString(String field)
- Prints a user-readable version of this query.
- Overrides:
toString
in class Query