Class NumericQueryNode
java.lang.Object
org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl
org.apache.lucene.queryparser.flexible.standard.nodes.NumericQueryNode
- All Implemented Interfaces:
Cloneable,FieldableNode,FieldValuePairQueryNode<Number>,QueryNode,ValueQueryNode<Number>
This query node represents a field query that holds a numeric value. It is
similar to
FieldQueryNode, however the getValue() returns a
Number.- See Also:
-
Field Summary
Fields inherited from class org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl
PLAINTEXT_FIELD_NAME -
Constructor Summary
ConstructorsConstructorDescriptionNumericQueryNode(CharSequence field, Number value, NumberFormat numberFormat) Creates aNumericQueryNodeobject using the given field,Numbervalue andNumberFormatused to convert the value toString. -
Method Summary
Modifier and TypeMethodDescriptiongetField()Returns the field associated with this node.Returns theNumberFormatused to convert the value toString.getValue()Returns the numeric value asNumber.voidsetField(CharSequence fieldName) Sets the field associated with this node.voidsetNumberFormat(NumberFormat format) Sets theNumberFormatused to convert the value toString.voidSets the numeric value.toQueryString(EscapeQuerySyntax escapeSyntaxParser) convert to a query string understood by the query parsertoString()Every implementation of this class should return pseudo xml like this: For FieldQueryNode: <field start='1' end='2' field='subject' text='foo'/>Methods inherited from class org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl
add, add, clone, cloneTree, containsTag, getChildren, getParent, getTag, getTagMap, isLeaf, removeFromParent, set, setTag, unsetTagMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.lucene.queryparser.flexible.core.nodes.QueryNode
add, add, cloneTree, containsTag, getChildren, getParent, getTag, getTagMap, isLeaf, removeFromParent, set, setTag, unsetTag
-
Constructor Details
-
NumericQueryNode
Creates aNumericQueryNodeobject using the given field,Numbervalue andNumberFormatused to convert the value toString.- Parameters:
field- the field associated with this query nodevalue- the value hold by this nodenumberFormat- theNumberFormatused to convert the value toString
-
-
Method Details
-
getField
Returns the field associated with this node.- Specified by:
getFieldin interfaceFieldableNode- Returns:
- the field associated with this node
-
setField
Sets the field associated with this node.- Specified by:
setFieldin interfaceFieldableNode- Parameters:
fieldName- the field associated with this node
-
toQueryString
Description copied from interface:QueryNodeconvert to a query string understood by the query parser- Specified by:
toQueryStringin interfaceQueryNode
-
setNumberFormat
Sets theNumberFormatused to convert the value toString.- Parameters:
format- theNumberFormatused to convert the value toString
-
getNumberFormat
Returns theNumberFormatused to convert the value toString.- Returns:
- the
NumberFormatused to convert the value toString
-
getValue
Returns the numeric value asNumber.- Specified by:
getValuein interfaceValueQueryNode<Number>- Returns:
- the numeric value
-
setValue
Sets the numeric value.- Specified by:
setValuein interfaceValueQueryNode<Number>- Parameters:
value- the numeric value
-
toString
Description copied from class:QueryNodeImplEvery implementation of this class should return pseudo xml like this: For FieldQueryNode: <field start='1' end='2' field='subject' text='foo'/>- Specified by:
toStringin interfaceQueryNode- Overrides:
toStringin classQueryNodeImpl- See Also:
-