public class NodeBooleanQuery extends NodeQuery
NodeQuery
that matches a boolean combination of primitive queries, e.g.,
NodeTermQuery
s, NodePhraseQuery
s, NodeBooleanQuery
s,
...
Code taken from BooleanQuery
and adapted for the Siren use case.
Modifier and Type | Class and Description |
---|---|
class |
NodeBooleanQuery.NodeBooleanWeight
Expert: the Weight for
NodeBooleanQuery , used to
normalize, score and explain these queries. |
static class |
NodeBooleanQuery.TooManyClauses
Thrown when an attempt is made to add more than
getMaxClauseCount() clauses. |
Modifier and Type | Field and Description |
---|---|
protected ArrayList<NodeBooleanClause> |
clauses |
ancestor, levelConstraint, lowerBound, upperBound
Constructor and Description |
---|
NodeBooleanQuery()
Constructs an empty boolean query.
|
Modifier and Type | Method and Description |
---|---|
void |
add(NodeBooleanClause clause)
Adds a clause to a boolean query.
|
void |
add(NodeQuery query,
NodeBooleanClause.Occur occur)
Adds a clause to a boolean query.
|
List<NodeBooleanClause> |
clauses()
Returns the list of clauses in this query.
|
org.apache.lucene.search.Query |
clone() |
org.apache.lucene.search.Weight |
createWeight(org.apache.lucene.search.IndexSearcher searcher) |
boolean |
equals(Object o)
Returns true iff
o is equal to this. |
void |
extractTerms(Set<org.apache.lucene.index.Term> terms) |
NodeBooleanClause[] |
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.
|
Iterator<NodeBooleanClause> |
iterator()
Returns an iterator on the clauses in this query.
|
org.apache.lucene.search.Query |
rewrite(org.apache.lucene.index.IndexReader reader) |
protected void |
setAncestorPointer(NodeQuery ancestor)
Expert: Add a pointer to the node query ancestor
|
void |
setLevelConstraint(int levelConstraint)
Set a constraint on the node's level
|
static void |
setMaxClauseCount(int maxClauseCount)
Set the maximum number of clauses permitted per BooleanQuery.
|
void |
setNodeConstraint(int lowerBound,
int upperBound)
Set an index interval constraint for a node.
|
String |
toString(String field)
Prints a user-readable version of this query.
|
getDocsNodesAndPositionsEnum, getLevelConstraint, getNodeConstraint, setNodeConstraint
protected ArrayList<NodeBooleanClause> clauses
public static int getMaxClauseCount()
NodeBooleanQuery.TooManyClauses
to be thrown.setMaxClauseCount(int)
public static void setMaxClauseCount(int maxClauseCount)
public void setLevelConstraint(int levelConstraint)
NodeQuery
Given that the root of the tree (level 0) is the document id, the node
level constraint ranges from 1 to Integer.MAX_VALUE
. A node
level constraint of 0 will always return false.
setLevelConstraint
in class NodeQuery
public void setNodeConstraint(int lowerBound, int upperBound)
NodeQuery
setNodeConstraint
in class NodeQuery
protected void setAncestorPointer(NodeQuery ancestor)
NodeQuery
The pointer to node query ancestor is used to retrieve node constraints from ancestors.
setAncestorPointer
in class NodeQuery
public void add(NodeQuery query, NodeBooleanClause.Occur occur)
NodeBooleanQuery.TooManyClauses
- if the new number of clauses exceeds the maximum clause numbergetMaxClauseCount()
public void add(NodeBooleanClause clause)
NodeBooleanQuery.TooManyClauses
- if the new number of clauses exceeds the maximum clause numbergetMaxClauseCount()
public NodeBooleanClause[] getClauses()
public List<NodeBooleanClause> clauses()
public final Iterator<NodeBooleanClause> iterator()
Iterable
interface to make it possible to do:
for (SirenBooleanClause clause : booleanQuery) {}
public org.apache.lucene.search.Weight createWeight(org.apache.lucene.search.IndexSearcher searcher) throws IOException
createWeight
in class org.apache.lucene.search.Query
IOException
public org.apache.lucene.search.Query rewrite(org.apache.lucene.index.IndexReader reader) throws IOException
rewrite
in class org.apache.lucene.search.Query
IOException
public void extractTerms(Set<org.apache.lucene.index.Term> terms)
extractTerms
in class org.apache.lucene.search.Query
public org.apache.lucene.search.Query clone()
clone
in class org.apache.lucene.search.Query
public String toString(String field)
toString
in class org.apache.lucene.search.Query
public boolean equals(Object o)
o
is equal to this.equals
in class org.apache.lucene.search.Query
public int hashCode()
hashCode
in class org.apache.lucene.search.Query
Copyright © 2014. All rights reserved.