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 aNumericQueryNode
object using the given field,Number
value andNumberFormat
used to convert the value toString
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.CharSequence
getField()
Returns the field associated with this node.java.text.NumberFormat
getNumberFormat()
Returns theNumberFormat
used to convert the value toString
.java.lang.Number
getValue()
Returns the numeric value asNumber
.void
setField(java.lang.CharSequence fieldName)
Sets the field associated with this node.void
setNumberFormat(java.text.NumberFormat format)
Sets theNumberFormat
used to convert the value toString
.void
setValue(java.lang.Number value)
Sets the numeric value.java.lang.CharSequence
toQueryString(EscapeQuerySyntax escapeSyntaxParser)
convert to a query string understood by the query parserjava.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'/>-
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 aNumericQueryNode
object using the given field,Number
value andNumberFormat
used to convert the value toString
.- Parameters:
field
- the field associated with this query nodevalue
- the value hold by this nodenumberFormat
- theNumberFormat
used to convert the value toString
-
-
Method Detail
-
getField
public java.lang.CharSequence getField()
Returns the field associated with this node.- Specified by:
getField
in 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:
setField
in interfaceFieldableNode
- Parameters:
fieldName
- the field associated with this node
-
toQueryString
public java.lang.CharSequence toQueryString(EscapeQuerySyntax escapeSyntaxParser)
Description copied from interface:QueryNode
convert to a query string understood by the query parser- Specified by:
toQueryString
in interfaceQueryNode
-
setNumberFormat
public void setNumberFormat(java.text.NumberFormat format)
Sets theNumberFormat
used to convert the value toString
.- Parameters:
format
- theNumberFormat
used to convert the value toString
-
getNumberFormat
public java.text.NumberFormat getNumberFormat()
Returns theNumberFormat
used to convert the value toString
.- Returns:
- the
NumberFormat
used to convert the value toString
-
getValue
public java.lang.Number getValue()
Returns the numeric value asNumber
.- Specified by:
getValue
in interfaceValueQueryNode<java.lang.Number>
- Returns:
- the numeric value
-
setValue
public void setValue(java.lang.Number value)
Sets the numeric value.- Specified by:
setValue
in interfaceValueQueryNode<java.lang.Number>
- Parameters:
value
- the numeric value
-
toString
public java.lang.String toString()
Description copied from class:QueryNodeImpl
Every implementation of this class should return pseudo xml like this: For FieldQueryNode: <field start='1' end='2' field='subject' text='foo'/>- Specified by:
toString
in interfaceQueryNode
- Overrides:
toString
in classQueryNodeImpl
- See Also:
QueryNode.toString()
-
-