Class NumericQueryNode
- java.lang.Object
-
- org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl
-
- org.apache.lucene.queryparser.flexible.standard.nodes.NumericQueryNode
-
- All Implemented Interfaces:
java.lang.Cloneable,FieldableNode,FieldValuePairQueryNode<java.lang.Number>,QueryNode,ValueQueryNode<java.lang.Number>
public class NumericQueryNode extends QueryNodeImpl implements FieldValuePairQueryNode<java.lang.Number>
This query node represents a field query that holds a numeric value. It is similar toFieldQueryNode, however thegetValue()returns aNumber.- See Also:
NumericConfig
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.queryparser.flexible.core.nodes.QueryNodeImpl
PLAINTEXT_FIELD_NAME
-
-
Constructor Summary
Constructors Constructor Description NumericQueryNode(java.lang.CharSequence field, java.lang.Number value, java.text.NumberFormat numberFormat)Creates aNumericQueryNodeobject using the given field,Numbervalue andNumberFormatused to convert the value toString.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.CharSequencegetField()Returns the field associated with this node.java.text.NumberFormatgetNumberFormat()Returns theNumberFormatused to convert the value toString.java.lang.NumbergetValue()Returns the numeric value asNumber.voidsetField(java.lang.CharSequence fieldName)Sets the field associated with this node.voidsetNumberFormat(java.text.NumberFormat format)Sets theNumberFormatused to convert the value toString.voidsetValue(java.lang.Number value)Sets the numeric value.java.lang.CharSequencetoQueryString(EscapeQuerySyntax escapeSyntaxParser)convert to a query string understood by the query parserjava.lang.StringtoString()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, unsetTag
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods 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 Detail
-
NumericQueryNode
public NumericQueryNode(java.lang.CharSequence field, java.lang.Number value, java.text.NumberFormat numberFormat)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 Detail
-
getField
public java.lang.CharSequence getField()
Returns the field associated with this node.- Specified by:
getFieldin interfaceFieldableNode- Returns:
- the field associated with this node
-
setField
public void setField(java.lang.CharSequence fieldName)
Sets the field associated with this node.- Specified by:
setFieldin interfaceFieldableNode- Parameters:
fieldName- the field associated with this node
-
toQueryString
public java.lang.CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser)
Description copied from interface:QueryNodeconvert to a query string understood by the query parser- Specified by:
toQueryStringin interfaceQueryNode
-
setNumberFormat
public void setNumberFormat(java.text.NumberFormat format)
Sets theNumberFormatused to convert the value toString.- Parameters:
format- theNumberFormatused to convert the value toString
-
getNumberFormat
public java.text.NumberFormat getNumberFormat()
Returns theNumberFormatused to convert the value toString.- Returns:
- the
NumberFormatused to convert the value toString
-
getValue
public java.lang.Number getValue()
Returns the numeric value asNumber.- Specified by:
getValuein interfaceValueQueryNode<java.lang.Number>- Returns:
- the numeric value
-
setValue
public void setValue(java.lang.Number value)
Sets the numeric value.- Specified by:
setValuein interfaceValueQueryNode<java.lang.Number>- Parameters:
value- the numeric value
-
toString
public java.lang.String 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:
QueryNode.toString()
-
-