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
,java.lang.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(java.lang.StringBuilder buffer)
Appends the index prefix if necessary and delegates to the subclassvoid
disclose(Discloser discloser)
int
encode(java.nio.ByteBuffer buffer)
Substring
getOrigin()
Returns the substring which is the raw form of the text leading to this token.abstract java.lang.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()
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()
Does this item represent "usual words"?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(java.lang.String value)
Sets the value of this item from a string.-
Methods inherited from class com.yahoo.prelude.query.SimpleIndexedItem
appendIndexString, encodeThis, equals, getIndexedString, getIndexName, hashCode, 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
-
-
-
-
Constructor Detail
-
TermItem
public TermItem()
-
TermItem
public TermItem(java.lang.String indexName)
-
TermItem
public TermItem(java.lang.String indexName, boolean isFromQuery)
-
TermItem
protected TermItem(java.lang.String indexName, boolean isFromQuery, Substring origin)
-
-
Method Detail
-
appendBodyString
protected final void appendBodyString(java.lang.StringBuilder buffer)
Appends the index prefix if necessary and delegates to the subclass- Specified by:
appendBodyString
in classItem
-
setValue
public abstract void setValue(java.lang.String value)
Sets the value of this item from a string.- Throws:
java.lang.UnsupportedOperationException
- if this is not supported on this kind of item
-
getRawWord
public abstract java.lang.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
-
isWords
public abstract boolean isWords()
Description copied from interface:BlockItem
Does this item represent "usual words"?
-
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)
-
-