Package com.yahoo.prelude.query
Class WordAlternativesItem
- java.lang.Object
-
- com.yahoo.prelude.query.Item
-
- com.yahoo.prelude.query.SimpleTaggableItem
-
- com.yahoo.prelude.query.SimpleIndexedItem
-
- com.yahoo.prelude.query.TermItem
-
- com.yahoo.prelude.query.WordAlternativesItem
-
- All Implemented Interfaces:
BlockItem
,HasIndexItem
,IndexedItem
,TaggableItem
,java.lang.Cloneable
public class WordAlternativesItem extends TermItem
A set of words with differing exactness scores to be used for literal boost ranking.- Author:
- Steinar Knutsen
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WordAlternativesItem.Alternative
-
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 WordAlternativesItem(java.lang.String indexName, boolean isFromQuery, Substring origin, java.util.Collection<WordAlternativesItem.Alternative> terms)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTerm(java.lang.String term, double exactness)
Add a new alternative iff the term string is not already present with an equal or higher exactness score.void
encodeThis(java.nio.ByteBuffer target)
java.util.List<WordAlternativesItem.Alternative>
getAlternatives()
Return an immutable snapshot of the contained terms.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 itemint
getNumWords()
Returns how many phrase words does this item containjava.lang.String
getRawWord()
Returns the raw form of the text leading to this term, exactly as received, including original casingboolean
isStemmed()
boolean
isWords()
Does this item represent "usual words"?void
setAlternatives(java.util.Collection<WordAlternativesItem.Alternative> terms)
void
setValue(java.lang.String value)
Sets the value of this item from a 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, equals, 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, 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
-
WordAlternativesItem
public WordAlternativesItem(java.lang.String indexName, boolean isFromQuery, Substring origin, java.util.Collection<WordAlternativesItem.Alternative> terms)
-
-
Method Detail
-
setAlternatives
public void setAlternatives(java.util.Collection<WordAlternativesItem.Alternative> terms)
-
stringValue
public java.lang.String stringValue()
Description copied from interface:BlockItem
Returns the value of this term as a string
-
isStemmed
public boolean isStemmed()
-
getNumWords
public int getNumWords()
Description copied from interface:HasIndexItem
Returns how many phrase words does this item contain
-
setValue
public void setValue(java.lang.String value)
Description copied from class:TermItem
Sets the value of this item from a string.
-
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
-
isWords
public boolean isWords()
Description copied from interface:BlockItem
Does this item represent "usual words"?
-
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
-
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
-
getAlternatives
public java.util.List<WordAlternativesItem.Alternative> getAlternatives()
Return an immutable snapshot of the contained terms. This list will not reflect later changes to the item.- Returns:
- an immutable list of word alternatives and their respective scores
-
encodeThis
public void encodeThis(java.nio.ByteBuffer target)
- Overrides:
encodeThis
in classSimpleIndexedItem
-
addTerm
public void addTerm(java.lang.String term, double exactness)
Add a new alternative iff the term string is not already present with an equal or higher exactness score. If the term string is present with a lower exactness score, the new, higher score will take precedence.- Parameters:
term
- one of several string interpretations of the input wordexactness
- how close the term string matches what the user input
-
-