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
,java.lang.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(com.yahoo.prelude.query.parser.Token word, boolean isFromQuery)
WordItem(java.lang.String word)
WordItem(java.lang.String word, boolean isFromQuery)
WordItem(java.lang.String word, boolean isFromQuery, Substring origin)
WordItem(java.lang.String word, java.lang.String indexName)
WordItem(java.lang.String word, java.lang.String indexName, boolean isFromQuery)
WordItem(java.lang.String word, java.lang.String indexName, boolean isFromQuery, Substring origin)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
appendHeadingString(java.lang.StringBuilder buffer)
Word items uses a empty heading instead of "WORD "void
disclose(com.yahoo.prelude.query.textualrepresentation.Discloser discloser)
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 itemprotected java.lang.String
getEncodedWord()
Returns the word for encoding.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()
Get the word exactly as received in the request.int
getSegmentIndex()
java.lang.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(java.lang.String value)
Same as #setWordvoid
setWord(java.lang.String word)
void
setWords(boolean words)
Sets if this consists of regular word characters (true) or represents a "special token" (false)java.lang.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, 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
-
WordItem
public WordItem(java.lang.String word)
-
WordItem
public WordItem(java.lang.String word, java.lang.String indexName)
-
WordItem
public WordItem(java.lang.String word, boolean isFromQuery)
-
WordItem
public WordItem(java.lang.String word, java.lang.String indexName, boolean isFromQuery)
-
WordItem
public WordItem(com.yahoo.prelude.query.parser.Token word, boolean isFromQuery)
-
WordItem
public WordItem(java.lang.String word, boolean isFromQuery, Substring origin)
-
WordItem
public WordItem(java.lang.String word, java.lang.String indexName, boolean isFromQuery, Substring origin)
-
-
Method Detail
-
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
-
setWord
public void setWord(java.lang.String word)
-
encodeThis
protected void encodeThis(java.nio.ByteBuffer buffer)
- Overrides:
encodeThis
in classSimpleIndexedItem
-
getEncodedWord
protected java.lang.String getEncodedWord()
Returns the word for encoding. By default simply the word
-
getWord
public java.lang.String getWord()
Returns the same asstringValue()
-
stringValue
public java.lang.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(java.lang.String value)
Same as #setWord
-
getRawWord
public java.lang.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(java.lang.StringBuilder buffer)
Word items uses a empty heading instead of "WORD "- 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
-
getNumWords
public int getNumWords()
Description copied from interface:HasIndexItem
Returns how many phrase words does this item contain
-
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
-
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)
-
-