Class NumericQueryNode
- java.lang.Object
-
- org.apache.lucene.queryParser.core.nodes.QueryNodeImpl
-
- org.apache.lucene.queryParser.standard.nodes.NumericQueryNode
-
- All Implemented Interfaces:
Serializable,Cloneable,FieldableNode,FieldValuePairQueryNode<Number>,QueryNode,ValueQueryNode<Number>
public class NumericQueryNode extends QueryNodeImpl implements FieldValuePairQueryNode<Number>
This query node represents a field query that holds a numeric value. It is similar toFieldQueryNode, however thegetValue()returns aNumber.- See Also:
NumericConfig, Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.queryParser.core.nodes.QueryNodeImpl
PLAINTEXT_FIELD_NAME, toQueryStringIgnoreFields
-
-
Constructor Summary
Constructors Constructor Description NumericQueryNode(CharSequence field, Number value, 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 CharSequencegetField()Returns the field associated with this node.NumberFormatgetNumberFormat()Returns theNumberFormatused to convert the value toString.protected CharSequencegetTermEscaped(EscapeQuerySyntax escaper)This method is used to get the value converted toStringand escaped using the givenEscapeQuerySyntax.NumbergetValue()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.voidsetValue(Number value)Sets the numeric value.CharSequencetoQueryString(EscapeQuerySyntax escapeSyntaxParser)convert to a query string understood by the query parserStringtoString()Every implementation of this class should return pseudo xml like this: For FieldQueryNode:-
Methods inherited from class org.apache.lucene.queryParser.core.nodes.QueryNodeImpl
add, add, allocate, clone, cloneTree, containsTag, containsTag, getChildren, getParent, getTag, getTag, getTagMap, getTags, isDefaultField, isLeaf, isRoot, set, setLeaf, setTag, setTag, unsetTag, unsetTag
-
-
-
-
Constructor Detail
-
NumericQueryNode
public NumericQueryNode(CharSequence field, Number value, 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 CharSequence getField()
Returns the field associated with this node.- Specified by:
getFieldin interfaceFieldableNode- Returns:
- the field associated with this node
-
setField
public void setField(CharSequence fieldName)
Sets the field associated with this node.- Specified by:
setFieldin interfaceFieldableNode- Parameters:
fieldName- the field associated with this node
-
getTermEscaped
protected CharSequence getTermEscaped(EscapeQuerySyntax escaper)
This method is used to get the value converted toStringand escaped using the givenEscapeQuerySyntax.- Parameters:
escaper- theEscapeQuerySyntaxused to escape the valueString- Returns:
- the value converte to
Stringand escaped
-
toQueryString
public 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(NumberFormat format)
Sets theNumberFormatused to convert the value toString.- Parameters:
format- theNumberFormatused to convert the value toString
-
getNumberFormat
public NumberFormat getNumberFormat()
Returns theNumberFormatused to convert the value toString.- Returns:
- the
NumberFormatused to convert the value toString
-
getValue
public Number getValue()
Returns the numeric value asNumber.- Specified by:
getValuein interfaceValueQueryNode<Number>- Returns:
- the numeric value
-
setValue
public void setValue(Number value)
Sets the numeric value.- Specified by:
setValuein interfaceValueQueryNode<Number>- Parameters:
value- the numeric value
-
toString
public String toString()
Description copied from class:QueryNodeImplEvery implementation of this class should return pseudo xml like this: For FieldQueryNode:- Specified by:
toStringin interfaceQueryNode- Overrides:
toStringin classQueryNodeImpl- See Also:
QueryNode.toString()
-
-