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
|
| Modifier and Type | Field and Description |
|---|---|
private int |
distance |
private java.lang.CharSequence |
field |
private boolean |
inorder |
private ProximityQueryNode.Type |
proximityType |
PLAINTEXT_FIELD_NAME, toQueryStringIgnoreFields| Constructor and Description |
|---|
ProximityQueryNode(java.util.List<QueryNode> clauses,
java.lang.CharSequence field,
ProximityQueryNode.Type type,
boolean inorder) |
ProximityQueryNode(java.util.List<QueryNode> clauses,
java.lang.CharSequence field,
ProximityQueryNode.Type type,
int distance,
boolean inorder) |
| Modifier and Type | Method and Description |
|---|---|
private static void |
clearFields(java.util.List<QueryNode> nodes,
java.lang.CharSequence field) |
QueryNode |
cloneTree()
Recursive clone the QueryNode tree The tags are not copied to the new tree
when you call the cloneTree() method
|
int |
getDistance() |
java.lang.CharSequence |
getField()
returns null if the field was not specified in the query string
|
java.lang.String |
getFieldAsString()
returns null if the field was not specified in the query string
|
ProximityQueryNode.Type |
getProximityType() |
boolean |
isInOrder() |
void |
setField(java.lang.CharSequence field) |
java.lang.CharSequence |
toQueryString(EscapeQuerySyntax escapeSyntaxParser)
convert to a query string understood by the query parser
|
java.lang.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, unsetTagprivate ProximityQueryNode.Type proximityType
private int distance
private boolean inorder
private java.lang.CharSequence field
public ProximityQueryNode(java.util.List<QueryNode> clauses, java.lang.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(java.util.List<QueryNode> clauses, java.lang.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
clausesprivate static void clearFields(java.util.List<QueryNode> nodes, java.lang.CharSequence field)
public ProximityQueryNode.Type getProximityType()
public java.lang.String toString()
QueryNodeImpltoString in interface QueryNodetoString in class BooleanQueryNodeQueryNode.toString()public java.lang.CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser)
QueryNodetoQueryString in interface QueryNodetoQueryString in class BooleanQueryNodepublic QueryNode cloneTree() throws java.lang.CloneNotSupportedException
QueryNodecloneTree in interface QueryNodecloneTree in class BooleanQueryNodejava.lang.CloneNotSupportedExceptionpublic int getDistance()
public java.lang.CharSequence getField()
public java.lang.String getFieldAsString()
public void setField(java.lang.CharSequence field)
field - the field to setpublic boolean isInOrder()