public class TwigQueryNode
extends org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl
implements org.apache.lucene.queryparser.flexible.core.nodes.FieldableNode
TwigQueryNode
represents a structured query, i.e., a TwigQuery
.
It is composed of two nodes, a root and of a direct child.
A node with multiple children can be built by passing an
ArrayQueryNode
to the setChild(QueryNode)
.
A complex twig can be built by chaining multiple TwigQueryNode
.
Constructor and Description |
---|
TwigQueryNode(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode root,
org.apache.lucene.queryparser.flexible.core.nodes.QueryNode child)
Build a
TwigQueryNode where the root can be either
an WildcardNodeQueryNode or a NodeBooleanQueryNode . |
Modifier and Type | Method and Description |
---|---|
org.apache.lucene.queryparser.flexible.core.nodes.QueryNode |
getChild()
Returns the child of the twig.
|
CharSequence |
getField() |
org.apache.lucene.queryparser.flexible.core.nodes.QueryNode |
getRoot()
Returns the root of the twig.
|
int |
getRootLevel()
Get the level of the root node in the document tree.
|
void |
setChild(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode child)
Set the child of the twig.
|
void |
setField(CharSequence fieldName) |
void |
setRoot(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode root)
Set the root of the twig
|
void |
setRootLevel(int rootLevel)
Set the level of the root node in the document tree.
|
CharSequence |
toQueryString(org.apache.lucene.queryparser.flexible.core.parser.EscapeQuerySyntax escapeSyntaxParser) |
String |
toString() |
add, add, allocate, clone, cloneTree, containsTag, getChildren, getParent, getTag, getTagMap, isDefaultField, isLeaf, isRoot, set, setLeaf, setTag, unsetTag
public TwigQueryNode(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode root, org.apache.lucene.queryparser.flexible.core.nodes.QueryNode child)
TwigQueryNode
where the root can be either
an WildcardNodeQueryNode
or a NodeBooleanQueryNode
.
In addition to the root, the child node can be an ArrayQueryNode
or another TwigQueryNode
.root
- the QueryNode
as the root of the twigchild
- the QueryNode
as the child of the twigpublic void setRoot(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode root)
public org.apache.lucene.queryparser.flexible.core.nodes.QueryNode getRoot()
public void setChild(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode child)
public org.apache.lucene.queryparser.flexible.core.nodes.QueryNode getChild()
public void setRootLevel(int rootLevel)
NodeQuery.setLevelConstraint(int)
public int getRootLevel()
If no root level has been set, -1
is returned.
NodeQuery.setLevelConstraint(int)
public CharSequence getField()
getField
in interface org.apache.lucene.queryparser.flexible.core.nodes.FieldableNode
public void setField(CharSequence fieldName)
setField
in interface org.apache.lucene.queryparser.flexible.core.nodes.FieldableNode
public String toString()
toString
in interface org.apache.lucene.queryparser.flexible.core.nodes.QueryNode
toString
in class org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl
public CharSequence toQueryString(org.apache.lucene.queryparser.flexible.core.parser.EscapeQuerySyntax escapeSyntaxParser)
toQueryString
in interface org.apache.lucene.queryparser.flexible.core.nodes.QueryNode
Copyright © 2014. All rights reserved.