public class ProximityQueryNode extends BooleanQueryNode
ProximityQueryNode
represents a query where the terms should meet
specific distance conditions. (a b c) WITHIN [SENTENCE|PARAGRAPH|NUMBER]
[INORDER] ("a" "b" "c") WITHIN [SENTENCE|PARAGRAPH|NUMBER] [INORDER]
TODO: Add this to the future standard Lucene parser/processor/builderModifier and Type | Class and Description |
---|---|
static class |
ProximityQueryNode.ProximityType
utility class containing the distance condition and number
|
static class |
ProximityQueryNode.Type
Distance condition: PARAGRAPH, SENTENCE, or NUMBER
|
PLAINTEXT_FIELD_NAME, toQueryStringIgnoreFields
Constructor and Description |
---|
ProximityQueryNode(List<QueryNode> clauses,
CharSequence field,
ProximityQueryNode.Type type,
boolean inorder) |
ProximityQueryNode(List<QueryNode> clauses,
CharSequence field,
ProximityQueryNode.Type type,
int distance,
boolean inorder) |
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
|
int |
getDistance() |
CharSequence |
getField()
returns null if the field was not specified in the query string
|
String |
getFieldAsString()
returns null if the field was not specified in the query string
|
ProximityQueryNode.Type |
getProximityType() |
boolean |
isInOrder() |
void |
setField(CharSequence 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, removeChildren, removeFromParent, set, setLeaf, setTag, unsetTag
public ProximityQueryNode(List<QueryNode> clauses, CharSequence field, ProximityQueryNode.Type type, int distance, boolean inorder)
clauses
- - QueryNode childrenfield
- - field nametype
- - type of proximity querydistance
- - positive integer that specifies the distanceinorder
- - true, if the tokens should be matched in the order of the
clausespublic ProximityQueryNode(List<QueryNode> clauses, CharSequence field, ProximityQueryNode.Type type, boolean inorder)
clauses
- - QueryNode childrenfield
- - field nametype
- - type of proximity queryinorder
- - true, if the tokens should be matched in the order of the
clausespublic ProximityQueryNode.Type getProximityType()
public String toString()
QueryNodeImpl
toString
in interface QueryNode
toString
in class BooleanQueryNode
QueryNode.toString()
public CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser)
QueryNode
toQueryString
in interface QueryNode
toQueryString
in class BooleanQueryNode
public QueryNode cloneTree() throws CloneNotSupportedException
QueryNode
cloneTree
in interface QueryNode
cloneTree
in class BooleanQueryNode
CloneNotSupportedException
public int getDistance()
public CharSequence getField()
public String getFieldAsString()
public void setField(CharSequence field)
field
- the field to setpublic boolean isInOrder()
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.