public abstract class NodeQuery
extends org.apache.lucene.search.Query
This class provides an interface to manage node constraints. When a
DocsNodesAndPositionsEnum
is requested using the method
getDocsNodesAndPositionsEnum(DocsAndPositionsEnum)
, it traverses
all the NodeQuery
ancestor of the current NodeQuery
and
creates a ConstraintStack
. Given the constraint stack, the
appropriate ConstrainedNodesEnum
is created and returned.
Modifier and Type | Field and Description |
---|---|
protected NodeQuery |
ancestor
The pointer to direct node query ancestor
|
protected int |
levelConstraint
The node level constraint.
|
protected int |
lowerBound
The lower and upper bound of the interval constraint over the node indexes.
|
protected int |
upperBound
The lower and upper bound of the interval constraint over the node indexes.
|
Constructor and Description |
---|
NodeQuery() |
Modifier and Type | Method and Description |
---|---|
protected DocsNodesAndPositionsEnum |
getDocsNodesAndPositionsEnum(org.apache.lucene.index.DocsAndPositionsEnum docsEnum)
Provides a
DocsNodesAndPositionsEnum given a
DocsAndPositionsEnum . |
int |
getLevelConstraint() |
int[] |
getNodeConstraint() |
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
|
void |
setNodeConstraint(int index)
Set the node index constraint.
|
void |
setNodeConstraint(int lowerBound,
int upperBound)
Set an index interval constraint for a node.
|
protected int levelConstraint
Set to sentinel value -1 by default.
protected int lowerBound
Set to sentinel value -1 by default.
protected int upperBound
Set to sentinel value -1 by default.
protected NodeQuery ancestor
public void setLevelConstraint(int levelConstraint)
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.
public int getLevelConstraint()
public void setNodeConstraint(int lowerBound, int upperBound)
public void setNodeConstraint(int index)
public int[] getNodeConstraint()
protected void setAncestorPointer(NodeQuery ancestor)
The pointer to node query ancestor is used to retrieve node constraints from ancestors.
protected DocsNodesAndPositionsEnum getDocsNodesAndPositionsEnum(org.apache.lucene.index.DocsAndPositionsEnum docsEnum)
DocsNodesAndPositionsEnum
given a
DocsAndPositionsEnum
. If a set of constraints is applied, it
automatically wraps the DocsNodesAndPositionsEnum
into a
ConstrainedNodesEnum
.Copyright © 2014. All rights reserved.