public class SlopQueryNode extends QueryNodeImpl implements FieldableNode
SlopQueryNode
represents phrase query with a slop.
From Lucene FAQ: Is there a way to use a proximity operator (like near or
within) with Lucene? There is a variable called slop that allows you to
perform NEAR/WITHIN-like queries. By default, slop is set to 0 so that only
exact phrases will match. When using TextParser you can use this syntax to
specify the slop: "doug cutting"~2 will find documents that contain
"doug cutting" as well as ones that contain "cutting doug".PLAINTEXT_FIELD_NAME, toQueryStringIgnoreFields
Constructor and Description |
---|
SlopQueryNode(QueryNode query,
int value) |
Modifier and Type | Method and Description |
---|---|
QueryNode |
cloneTree()
Recursive clone the QueryNode tree The tags are not copied to the new tree
when you call the cloneTree() method
|
QueryNode |
getChild() |
CharSequence |
getField()
Returns the field associated to the node and every node under it.
|
int |
getValue() |
void |
setField(CharSequence fieldName)
Associates the node to a field.
|
CharSequence |
toQueryString(EscapeQuerySyntax escapeSyntaxParser)
convert to a query string understood by the query parser
|
String |
toString()
Every implementation of this class should return pseudo xml like this:
For FieldQueryNode: <field start='1' end='2' field='subject' text='foo'/>
|
add, add, allocate, clone, containsTag, getChildren, getParent, getTag, getTagMap, isDefaultField, isLeaf, isRoot, removeFromParent, set, setLeaf, setTag, unsetTag
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
add, add, containsTag, getChildren, getParent, getTag, getTagMap, isLeaf, removeFromParent, set, setTag, unsetTag
public SlopQueryNode(QueryNode query, int value)
query
- - QueryNode Tree with the phrasevalue
- - slop valuepublic QueryNode getChild()
public int getValue()
public String toString()
QueryNodeImpl
toString
in interface QueryNode
toString
in class QueryNodeImpl
QueryNode.toString()
public CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser)
QueryNode
toQueryString
in interface QueryNode
public QueryNode cloneTree() throws CloneNotSupportedException
QueryNode
cloneTree
in interface QueryNode
cloneTree
in class QueryNodeImpl
CloneNotSupportedException
public CharSequence getField()
FieldableNode
getField
in interface FieldableNode
public void setField(CharSequence fieldName)
FieldableNode
setField
in interface FieldableNode
fieldName
- the field nameCopyright © 2000-2015 Apache Software Foundation. All Rights Reserved.