Package com.yahoo.prelude.query
Class WordItem
- 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.WordItem
-
- All Implemented Interfaces:
BlockItem
,HasIndexItem
,IndexedItem
,TaggableItem
,Cloneable
- Direct Known Subclasses:
ExactStringItem
,MarkerWordItem
,PrefixItem
,SubstringItem
,SuffixItem
public class WordItem extends TermItem
A simple word or token to match in some field.- 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
-
-
Constructor Summary
Constructors Constructor Description WordItem(Token word, boolean isFromQuery)
WordItem(String word)
WordItem(String word, boolean isFromQuery)
WordItem(String word, boolean isFromQuery, Substring origin)
WordItem(String word, String indexName)
WordItem(String word, String indexName, boolean isFromQuery)
WordItem(String word, String indexName, boolean isFromQuery, Substring origin)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
appendHeadingString(StringBuilder buffer)
Word items uses a empty heading instead of "WORD "void
disclose(Discloser discloser)
protected void
encodeThis(ByteBuffer buffer)
boolean
equals(Object o)
Returns whether this item is of the same class and contains the same state as the given item.protected String
getEncodedWord()
Returns the word for encoding.String
getIndexedString()
Return the searchable term contents of this item.Item.ItemType
getItemType()
Return the enumerated type of this item.String
getName()
Returns the name of this itemint
getNumWords()
Returns how many phrase words does this item containString
getRawWord()
Get the word exactly as received in the request.int
getSegmentIndex()
String
getWord()
Returns the same asstringValue()
int
hashCode()
boolean
isFromSegmented()
boolean
isLowercased()
boolean
isStemmed()
boolean
isWords()
Returns true if this consists of regular word characters.void
setFromSegmented(boolean fromSegmented)
void
setLowercased(boolean lowercased)
void
setSegmentIndex(int segmentIndex)
void
setStemmed(boolean stemmed)
void
setValue(String value)
Same as #setWordvoid
setWord(String word)
void
setWords(boolean words)
Sets if this consists of regular word characters (true) or represents a "special token" (false)String
stringValue()
Returns this word as it should be used in executing the query.-
Methods inherited from class com.yahoo.prelude.query.TermItem
appendBodyString, encode, getOrigin, getSegmentingRule, getTermCount, isFromQuery, isNormalizable, setFromQuery, 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
-
-
-
-
Method Detail
-
getItemType
public Item.ItemType getItemType()
Description copied from class:Item
Return the enumerated type of this item.- Specified by:
getItemType
in classItem
-
setWord
public void setWord(String word)
-
encodeThis
protected void encodeThis(ByteBuffer buffer)
- Overrides:
encodeThis
in classSimpleIndexedItem
-
getEncodedWord
protected String getEncodedWord()
Returns the word for encoding. By default simply the word
-
getWord
public String getWord()
Returns the same asstringValue()
-
stringValue
public String stringValue()
Returns this word as it should be used in executing the query. This is usually (but not always) a normalized and stemmed form
-
setValue
public void setValue(String value)
Same as #setWord
-
getRawWord
public String getRawWord()
Get the word exactly as received in the request. This returns the same as getWord if no other raw form is known- Specified by:
getRawWord
in interfaceBlockItem
- Specified by:
getRawWord
in classTermItem
- Returns:
- the raw form of this word, never null
-
isStemmed
public boolean isStemmed()
-
setStemmed
public void setStemmed(boolean stemmed)
-
isFromSegmented
public boolean isFromSegmented()
-
setFromSegmented
public void setFromSegmented(boolean fromSegmented)
-
isLowercased
public boolean isLowercased()
-
setLowercased
public void setLowercased(boolean lowercased)
-
getSegmentIndex
public int getSegmentIndex()
-
setSegmentIndex
public void setSegmentIndex(int segmentIndex)
-
appendHeadingString
protected void appendHeadingString(StringBuilder buffer)
Word items uses a empty heading instead of "WORD "- Overrides:
appendHeadingString
in classItem
-
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.
-
getNumWords
public int getNumWords()
Description copied from interface:HasIndexItem
Returns how many phrase words does this item contain
-
getIndexedString
public 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
-
isWords
public boolean isWords()
Returns true if this consists of regular word characters. Returns false if this represents a "special token"
-
setWords
public void setWords(boolean words)
Sets if this consists of regular word characters (true) or represents a "special token" (false)
-
-