Package com.yahoo.prelude.query
Class IntItem
- java.lang.Object
-
- All Implemented Interfaces:
BlockItem
,HasIndexItem
,IndexedItem
,TaggableItem
,java.lang.Cloneable
- Direct Known Subclasses:
RangeItem
public class IntItem extends TermItem
This represents either- a number (integer or floating point)
- a partial range, given by "<number" or ">number", where the numbers are exclusive, or
- a full or open range "[number;number], "[number;]" or "[;number]" where the numbers are inclusive, or exclusive if a square bracket is replaced with a pointy one
- Author:
- bratseth
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.yahoo.prelude.query.Item
Item.ItemCreator, Item.ItemType
-
-
Field Summary
-
Fields inherited from class com.yahoo.prelude.query.Item
connectedBacklink, connectedItem, connectivity, DEFAULT_WEIGHT, explicitSignificance, significance, uniqueID
-
-
Constructor Summary
Constructors Constructor Description IntItem(int number, java.lang.String indexName)
Creates an int item which must be equal to the given int number - that is both the lower and upper limit is this numberIntItem(long number, java.lang.String indexName)
Creates an int item which must be equal to the given long number - that is both the lower and upper limit is this numberIntItem(Limit from, Limit to, int hitLimit, java.lang.String indexName, boolean isFromQuery)
IntItem(Limit from, Limit to, java.lang.String indexName)
IntItem(java.lang.String expression)
IntItem(java.lang.String expression, boolean isFromQuery)
IntItem(java.lang.String expression, java.lang.String indexName)
IntItem(java.lang.String expression, java.lang.String indexName, boolean isFromQuery)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
appendHeadingString(java.lang.StringBuilder buffer)
Int items uses a empty heading instead of "INT "protected void
encodeThis(java.nio.ByteBuffer buffer)
boolean
equals(java.lang.Object object)
Returns whether this item is of the same class and contains the same state as the given itemstatic IntItem
from(java.lang.String indexName, Limit from, Limit to, int hitLimit)
Creates an int item from arguments.protected java.lang.String
getEncodedInt()
Returns the number for encoding; the number expression as-is.Limit
getFromLimit()
Returns the lower limit of this range, which may be negative infinityint
getHitLimit()
Returns the number of hits this will match, or 0 if all should be matched.java.lang.String
getIndexedString()
Return the searchable term contents of this item.Item.ItemType
getItemType()
Return the enumerated type of this item.java.lang.String
getName()
Returns the name of this itemjava.lang.String
getNumber()
Sets the number expression of this - a number or rangeint
getNumWords()
java.lang.String
getRawWord()
Returns the raw form of the text leading to this term, exactly as received, including original casingLimit
getToLimit()
Returns the upper limit of this range, which may be positive infinityint
hashCode()
boolean
isStemmed()
boolean
isWords()
Does this item represent "usual words"?void
setHitLimit(int hitLimit)
Sets the number of hits this will match, or 0 if all should be matched.void
setNumber(java.lang.String expression)
Sets the number expression of this - a number or range following the syntax specified in the class javadocvoid
setValue(java.lang.String value)
Same assetNumber(java.lang.String)
java.lang.String
stringValue()
Returns the value of this term as a string-
Methods inherited from class com.yahoo.prelude.query.TermItem
appendBodyString, disclose, encode, getOrigin, getSegmentingRule, getTermCount, isFromQuery, isNormalizable, setNormalizable, setOrigin, setSegmentingRule
-
Methods inherited from class com.yahoo.prelude.query.SimpleIndexedItem
appendIndexString, getIndexName, setIndexName
-
Methods inherited from class com.yahoo.prelude.query.SimpleTaggableItem
getConnectedItem, getConnectivity, getSignificance, getUniqueID, hasExplicitSignificance, hasUniqueID, setConnectivity, setExplicitSignificance, setSignificance, setUniqueID
-
Methods inherited from class com.yahoo.prelude.query.Item
addAnnotation, clone, getAnnotation, getBytes, getCode, getCreator, getLabel, getLanguage, getParent, getWeight, hasAnnotation, hasConnectivityBackLink, isFilter, isFromSpecialToken, isProtected, isRanked, isRoot, putBytes, putString, setCreator, setFilter, setFromSpecialToken, setHasUniqueID, setLabel, setLanguage, setParent, setPositionData, setProtected, setRanked, setWeight, shouldParenthize, toString, usePositionData
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.yahoo.prelude.query.HasIndexItem
getIndexName
-
-
-
-
Constructor Detail
-
IntItem
public IntItem(int number, java.lang.String indexName)
Creates an int item which must be equal to the given int number - that is both the lower and upper limit is this number
-
IntItem
public IntItem(long number, java.lang.String indexName)
Creates an int item which must be equal to the given long number - that is both the lower and upper limit is this number
-
IntItem
public IntItem(java.lang.String expression)
-
IntItem
public IntItem(java.lang.String expression, boolean isFromQuery)
-
IntItem
public IntItem(java.lang.String expression, java.lang.String indexName)
-
IntItem
public IntItem(java.lang.String expression, java.lang.String indexName, boolean isFromQuery)
-
-
Method Detail
-
setNumber
public void setNumber(java.lang.String expression)
Sets the number expression of this - a number or range following the syntax specified in the class javadoc
-
getNumber
public java.lang.String getNumber()
Sets the number expression of this - a number or range
-
getFromLimit
public final Limit getFromLimit()
Returns the lower limit of this range, which may be negative infinity
-
getToLimit
public final Limit getToLimit()
Returns the upper limit of this range, which may be positive infinity
-
getHitLimit
public final int getHitLimit()
Returns the number of hits this will match, or 0 if all should be matched. If this number is positive, the hits closest tofrom
are returned, and if this number is negative the hits closest toto
are returned.
-
setHitLimit
public final void setHitLimit(int hitLimit)
Sets the number of hits this will match, or 0 if all should be matched. If this number is positive, the hits closest tofrom
are returned, and if this number is negative the hits closest toto
are returned.- Parameters:
hitLimit
- number of hits to match for this operator
-
getRawWord
public java.lang.String getRawWord()
Description copied from class:TermItem
Returns the raw form of the text leading to this term, exactly as received, including original casing- Specified by:
getRawWord
in interfaceBlockItem
- Specified by:
getRawWord
in classTermItem
-
getItemType
public Item.ItemType getItemType()
Description copied from class:Item
Return the enumerated type of this item.- Specified by:
getItemType
in classItem
-
getName
public java.lang.String getName()
Description copied from class:Item
Returns the name of this item
-
stringValue
public java.lang.String stringValue()
Description copied from interface:BlockItem
Returns the value of this term as a string
-
setValue
public void setValue(java.lang.String value)
Same assetNumber(java.lang.String)
-
appendHeadingString
protected void appendHeadingString(java.lang.StringBuilder buffer)
Int items uses a empty heading instead of "INT "- Overrides:
appendHeadingString
in classItem
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classSimpleIndexedItem
-
equals
public boolean equals(java.lang.Object object)
Description copied from class:Item
Returns whether this item is of the same class and contains the same state as the given item- Overrides:
equals
in classSimpleIndexedItem
-
getEncodedInt
protected java.lang.String getEncodedInt()
Returns the number for encoding; the number expression as-is.
-
getIndexedString
public java.lang.String getIndexedString()
Description copied from interface:IndexedItem
Return the searchable term contents of this item.- Specified by:
getIndexedString
in interfaceIndexedItem
- Specified by:
getIndexedString
in classSimpleIndexedItem
- Returns:
- a string representation of what is presumably stored in an index which will match this item
-
encodeThis
protected void encodeThis(java.nio.ByteBuffer buffer)
- Overrides:
encodeThis
in classSimpleIndexedItem
-
getNumWords
public int getNumWords()
- Returns:
- how many phrase words does this item contain
-
isStemmed
public boolean isStemmed()
-
isWords
public boolean isWords()
Description copied from interface:BlockItem
Does this item represent "usual words"?
-
from
public static IntItem from(java.lang.String indexName, Limit from, Limit to, int hitLimit)
Creates an int item from arguments. This will return an instance of the RankItem subclass if eitherhitLimit
or bothfrom
andto
is set to a value other than defaults (respectively 0, double negative and positive infinity). And different from each other.- Parameters:
indexName
- the index this searchesfrom
- the lower limit (inclusive) on hitsto
- the higher limit (inclusive) on hitshitLimit
- the number of hits to match, or 0 to return all
-
-