public class BooleanQuery extends java.lang.Object implements Query
MUST
, SHOULD
, or MUST_NOT
.
A BooleanQuery will match an object if and only if:
MUST
subquery;
SHOULD
subquery (or there is no such subquery); and
MUST_NOT
subquery.
MUST
; "OR" to SHOULD
; "NOT" to MUST_NOT
.BooleanClause
,
BooleanClause.Occur
Constructor and Description |
---|
BooleanQuery(java.util.Collection<BooleanClause> clauses)
Constructs an instance.
|
BooleanQuery(java.lang.Object... objects)
Constructs an instance from parameters which are each either BooleanClause, Query, or BooleanClause.Occur.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
accept(QueryVisitor<T> visitor)
Returns the result of applying a QueryVisitor to this query.
|
java.util.List<BooleanClause> |
clauses() |
boolean |
containsNoMustClauses() |
boolean |
onlyContainsMustNotClauses() |
java.lang.String |
toString() |
public BooleanQuery(java.util.Collection<BooleanClause> clauses)
clauses
- the clauses of the instancepublic BooleanQuery(java.lang.Object... objects)
Example: new BooleanQuery(q1,MUST,q2,SHOULD,q3,SHOULD,q4,MUST_NOT)
models q1 /\ (q2 \/ q3) /\ ~q4
.
objects
- the objects used to construct the instance. Each object must be a BooleanClause, a Query, or a BooleanClause.Occur. Each Query will be converted into a BooleanClause
with its Occur set to the next BooleanClause.Occur in the arguments. All the BooleanClauses become the clauses of the constructed instance.public java.util.List<BooleanClause> clauses()
public boolean onlyContainsMustNotClauses()
public boolean containsNoMustClauses()
public java.lang.String toString()
toString
in class java.lang.Object
public <T> T accept(QueryVisitor<T> visitor) throws RepositoryException
Query
accept
in interface Query
visitor
- the visitorRepositoryException