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/builder| Modifier 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, unsetTagpublic 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()
QueryNodeImpltoString in interface QueryNodetoString in class BooleanQueryNodeQueryNode.toString()public CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser)
QueryNodetoQueryString in interface QueryNodetoQueryString in class BooleanQueryNodepublic QueryNode cloneTree() throws CloneNotSupportedException
QueryNodecloneTree in interface QueryNodecloneTree in class BooleanQueryNodeCloneNotSupportedExceptionpublic int getDistance()
public CharSequence getField()
public String getFieldAsString()
public void setField(CharSequence field)
field - the field to setpublic boolean isInOrder()
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.