Package com.yahoo.prelude.query
Class SegmentItem
java.lang.Object
com.yahoo.prelude.query.Item
com.yahoo.prelude.query.CompositeItem
com.yahoo.prelude.query.SegmentItem
- All Implemented Interfaces:
BlockItem
,HasIndexItem
,Cloneable
- Direct Known Subclasses:
AndSegmentItem
,TaggableSegmentItem
An immutable and'ing of a collection of sub-expressions. It does not
extend AndItem to avoid code using instanceof handling it as an
AndItem.
- Author:
- Steinar Knutsen
-
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
ConstructorDescriptionSegmentItem
(String rawWord, String current, boolean isFromQuery, boolean stemmed) Creates a new segment itemSegmentItem
(String rawWord, String current, boolean isFromQuery, boolean stemmed, Substring origin) Creates a new segment item -
Method Summary
Modifier and TypeMethodDescriptionvoid
Inserts the item at a position and increases the index of existing items starting on this position by onevoid
clone()
Return a deep copy of this objectvoid
boolean
Returns whether this item is of the same class and contains the same state as the given item.int
Returns how many phrase words does this item containReturns null right nowThe untransformed raw text from the user serving as base for this item.If the block has to be resegmented, what operator should be chosen if it is necessary to change operator?int
hashCode()
boolean
Returns whether this block of text originates from a user and should therefore receive the normal processing applied to raw text (such as stemming).boolean
boolean
isLocked()
Whether this composite is in a mutable state.boolean
boolean
isWords()
Returns whether this item represents normal textvoid
lock()
Make composite immutable if this is supported.removeItem
(int index) Removes the item at the given indexboolean
removeItem
(Item item) Removes the given item.void
setFromUser
(boolean isFromUser) void
setSegmentingRule
(SegmentingRule segmentingRule) Returns the value of this term as a stringMethods inherited from class com.yahoo.prelude.query.CompositeItem
acceptsItemsOfType, adding, appendBodyString, encode, encodeThis, encodingArity, ensureNotInSubtree, extractSingleChild, getItem, getItemCount, getItemIndex, getItemIterator, getTermCount, items, setIndexName, setItem, shouldParenthesize
Methods inherited from class com.yahoo.prelude.query.Item
addAnnotation, appendHeadingString, getAnnotation, getBytes, getCode, getCreator, getItemType, getLabel, getLanguage, getName, getParent, getWeight, hasAnnotation, hasConnectivityBackLink, hasUniqueID, isFilter, isFromSpecialToken, isProtected, isRanked, isRoot, putBytes, putString, setCreator, setFilter, setFromSpecialToken, setHasUniqueID, setLabel, setLanguage, setParent, setPositionData, setProtected, setRanked, setWeight, 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 Details
-
SegmentItem
Creates a new segment item- Parameters:
rawWord
- the raw form of this segment as received in the requestcurrent
- the current transformed version of the raw form, or the raw form repeated if no normalized form is knownisFromQuery
- whether this segment stems from the query received in the requeststemmed
- whether this is stemmed
-
SegmentItem
public SegmentItem(String rawWord, String current, boolean isFromQuery, boolean stemmed, Substring origin) Creates a new segment item- Parameters:
rawWord
- the raw form of this segment as received in the requestcurrent
- the current transformed version of the raw form, or the raw form repeated if no normalized form is knownisFromQuery
- whether this segment stems from the query received in the requeststemmed
- whether this is stemmedorigin
- the original text that led to this
-
-
Method Details
-
getRawWord
Description copied from interface:BlockItem
The untransformed raw text from the user serving as base for this item.- Specified by:
getRawWord
in interfaceBlockItem
-
getNormalized
-
stringValue
Description copied from interface:BlockItem
Returns the value of this term as a string- Specified by:
stringValue
in interfaceBlockItem
-
isFromQuery
public boolean isFromQuery()Description copied from interface:BlockItem
Returns whether this block of text originates from a user and should therefore receive the normal processing applied to raw text (such as stemming).- Specified by:
isFromQuery
in interfaceBlockItem
-
isStemmed
public boolean isStemmed() -
lock
public void lock()Description copied from class:CompositeItem
Make composite immutable if this is supported.- Overrides:
lock
in classCompositeItem
-
isLocked
public boolean isLocked()Description copied from class:CompositeItem
Whether this composite is in a mutable state.- Overrides:
isLocked
in classCompositeItem
-
getNumWords
public int getNumWords()Description copied from interface:HasIndexItem
Returns how many phrase words does this item contain- Specified by:
getNumWords
in interfaceHasIndexItem
-
addItem
- Overrides:
addItem
in classCompositeItem
-
addItem
Description copied from class:CompositeItem
Inserts the item at a position and increases the index of existing items starting on this position by one- Overrides:
addItem
in classCompositeItem
-
removeItem
Description copied from class:CompositeItem
Removes the item at the given index- Overrides:
removeItem
in classCompositeItem
- Parameters:
index
- the index of the item to remove- Returns:
- the removed item
-
removeItem
Description copied from class:CompositeItem
Removes the given item. Does nothing if the item is not present.- Overrides:
removeItem
in classCompositeItem
- Parameters:
item
- the item to remove- Returns:
- whether the item was removed
-
clone
Return a deep copy of this object- Overrides:
clone
in classCompositeItem
-
isWords
public boolean isWords()Description copied from interface:BlockItem
Returns whether this item represents normal text -
isFromUser
public boolean isFromUser() -
setFromUser
public void setFromUser(boolean isFromUser) -
getOrigin
Returns null right now -
disclose
- Overrides:
disclose
in classCompositeItem
-
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
-
equals
Description copied from class:CompositeItem
Returns whether this item is of the same class and contains the same state as the given item.- Overrides:
equals
in classCompositeItem
-
hashCode
public int hashCode()- Overrides:
hashCode
in classCompositeItem
-