Package com.yahoo.prelude.query
Class TermItem
- java.lang.Object
-
- com.yahoo.prelude.query.Item
-
- com.yahoo.prelude.query.SimpleTaggableItem
-
- com.yahoo.prelude.query.SimpleIndexedItem
-
- com.yahoo.prelude.query.TermItem
-
- All Implemented Interfaces:
BlockItem
,HasIndexItem
,IndexedItem
,TaggableItem
,Cloneable
- Direct Known Subclasses:
BoolItem
,GeoLocationItem
,IntItem
,RegExpItem
,WordAlternativesItem
,WordItem
public abstract class TermItem extends SimpleIndexedItem implements BlockItem
Superclass of "leaf" conditions containing a single entity which is either matched in a field or not.- Author:
- bratseth, havardpe
-
-
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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
appendBodyString(StringBuilder buffer)
Appends the index prefix if necessary and delegates to the subclassvoid
disclose(Discloser discloser)
int
encode(ByteBuffer buffer)
boolean
equals(Object o)
Returns whether this item is of the same class and contains the same state as the given item.Substring
getOrigin()
Returns the substring which is the raw form of the text leading to this token.abstract String
getRawWord()
Returns the raw form of the text leading to this term, exactly as received, including original casingSegmentingRule
getSegmentingRule()
If the block has to be resegmented, what operator should be chosen if it is necessary to change operator?int
getTermCount()
int
hashCode()
boolean
isFromQuery()
Whether this term is from the query or has been added by a searcher.boolean
isNormalizable()
Returns whether accent removal is a meaningful and possible operation for this word.abstract boolean
isWords()
Returns whether this item represents normal textvoid
setFromQuery(boolean isFromQuery)
void
setNormalizable(boolean normalizable)
Sets whether accent removal is a meaningful and possible operation for this word.void
setOrigin(Substring origin)
Sets the origin of thisvoid
setSegmentingRule(SegmentingRule segmentingRule)
abstract void
setValue(String value)
Sets the value of this item from a string.-
Methods inherited from class com.yahoo.prelude.query.SimpleIndexedItem
appendIndexString, encodeThis, getIndexedString, 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, appendHeadingString, clone, getAnnotation, getBytes, getCode, getCreator, getItemType, getLabel, getLanguage, getName, 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.BlockItem
isStemmed, stringValue
-
Methods inherited from interface com.yahoo.prelude.query.HasIndexItem
getIndexName, getNumWords
-
-
-
-
Method Detail
-
encode
public final int encode(ByteBuffer buffer)
-
appendBodyString
protected final void appendBodyString(StringBuilder buffer)
Appends the index prefix if necessary and delegates to the subclass- Specified by:
appendBodyString
in classItem
-
setValue
public abstract void setValue(String value)
Sets the value of this item from a string.- Throws:
UnsupportedOperationException
- if this is not supported on this kind of item
-
getRawWord
public abstract String getRawWord()
Returns the raw form of the text leading to this term, exactly as received, including original casing- Specified by:
getRawWord
in interfaceBlockItem
-
getOrigin
public Substring getOrigin()
Returns the substring which is the raw form of the text leading to this token. This substring also contains the superstring this substring was a part of, e.g the whole query string. If this did not originate directly from a user string, this is null.
-
isFromQuery
public boolean isFromQuery()
Whether this term is from the query or has been added by a searcher. Only terms from the user should be modified by query rewriters which attempts to improve the precision or recall of the user's query.- Specified by:
isFromQuery
in interfaceBlockItem
-
setFromQuery
public void setFromQuery(boolean isFromQuery)
-
isWords
public abstract boolean isWords()
Description copied from interface:BlockItem
Returns whether this item represents normal text
-
setOrigin
public void setOrigin(Substring origin)
Sets the origin of this
-
disclose
public void disclose(Discloser discloser)
- Overrides:
disclose
in classSimpleIndexedItem
-
getTermCount
public int getTermCount()
- Specified by:
getTermCount
in classItem
-
isNormalizable
public boolean isNormalizable()
Returns whether accent removal is a meaningful and possible operation for this word.
-
setNormalizable
public void setNormalizable(boolean normalizable)
Sets whether accent removal is a meaningful and possible operation for this word.- Parameters:
normalizable
- set to true if accent removal can/should be performed
-
getSegmentingRule
public SegmentingRule getSegmentingRule()
Description copied from interface:BlockItem
If the block has to be resegmented, what operator should be chosen if it is necessary to change operator?- Specified by:
getSegmentingRule
in interfaceBlockItem
-
setSegmentingRule
public void setSegmentingRule(SegmentingRule segmentingRule)
-
equals
public boolean equals(Object o)
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
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classSimpleIndexedItem
-
-