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, documentFrequency, explicitSignificance, significance, uniqueID -
Constructor Summary
ConstructorsConstructorDescriptionSegmentItem(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 TypeMethodDescriptionvoidInserts the item at a position and increases the index of existing items starting on this position by onevoidclone()Return a deep copy of this objectvoidbooleanReturns whether this item is of the same class and contains the same state as the given item.intReturns 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?inthashCode()booleanReturns whether this block of text originates from a user and should therefore receive the normal processing applied to raw text (such as stemming).booleanbooleanisLocked()Whether this composite is in a mutable state.booleanbooleanisWords()Returns whether this item represents normal textvoidlock()Make composite immutable if this is supported.removeItem(int index) Removes the item at the given indexbooleanremoveItem(Item item) Removes the given item.voidsetFromUser(boolean isFromUser) voidsetSegmentingRule(SegmentingRule segmentingRule) voidsetStemmed(boolean stemmed) booleanwhether this item should be folded into a parent WeakAndItemvoidshouldFoldIntoWand(boolean value) set the flag for folding into a parent WeakAndItemReturns 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, shouldParenthesizeMethods inherited from class com.yahoo.prelude.query.Item
addAnnotation, appendHeadingString, getAnnotation, getBytes, getCode, getCreator, getItemType, getLabel, getLanguage, getName, getParent, getWeight, hasAnnotation, hasConnectivityBackLink, hasPrefixMatchSemantics, hasUniqueID, isFilter, isFromSpecialToken, isProtected, isRanked, isRoot, putBytes, putString, setCreator, setFilter, setFromSpecialToken, setHasUniqueID, setLabel, setLanguage, setParent, setPositionData, setProtected, setRanked, setWeight, toString, usePositionDataMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:BlockItemThe untransformed raw text from the user serving as base for this item.- Specified by:
getRawWordin interfaceBlockItem
-
getNormalized
-
stringValue
Description copied from interface:BlockItemReturns the value of this term as a string- Specified by:
stringValuein interfaceBlockItem
-
isFromQuery
public boolean isFromQuery()Description copied from interface:BlockItemReturns 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:
isFromQueryin interfaceBlockItem
-
isStemmed
public boolean isStemmed() -
setStemmed
public void setStemmed(boolean stemmed) -
lock
public void lock()Description copied from class:CompositeItemMake composite immutable if this is supported.- Overrides:
lockin classCompositeItem
-
isLocked
public boolean isLocked()Description copied from class:CompositeItemWhether this composite is in a mutable state.- Overrides:
isLockedin classCompositeItem
-
getNumWords
public int getNumWords()Description copied from interface:HasIndexItemReturns how many phrase words does this item contain- Specified by:
getNumWordsin interfaceHasIndexItem
-
addItem
- Overrides:
addItemin classCompositeItem
-
addItem
Description copied from class:CompositeItemInserts the item at a position and increases the index of existing items starting on this position by one- Overrides:
addItemin classCompositeItem
-
removeItem
Description copied from class:CompositeItemRemoves the item at the given index- Overrides:
removeItemin classCompositeItem- Parameters:
index- the index of the item to remove- Returns:
- the removed item
-
removeItem
Description copied from class:CompositeItemRemoves the given item. Does nothing if the item is not present.- Overrides:
removeItemin classCompositeItem- Parameters:
item- the item to remove- Returns:
- whether the item was removed
-
clone
Return a deep copy of this object- Overrides:
clonein classCompositeItem
-
isWords
public boolean isWords()Description copied from interface:BlockItemReturns whether this item represents normal text -
isFromUser
public boolean isFromUser() -
setFromUser
public void setFromUser(boolean isFromUser) -
getOrigin
Returns null right now -
disclose
- Overrides:
disclosein classCompositeItem
-
getSegmentingRule
Description copied from interface:BlockItemIf the block has to be resegmented, what operator should be chosen if it is necessary to change operator?- Specified by:
getSegmentingRulein interfaceBlockItem
-
setSegmentingRule
-
equals
Description copied from class:CompositeItemReturns whether this item is of the same class and contains the same state as the given item.- Overrides:
equalsin classCompositeItem
-
hashCode
public int hashCode()- Overrides:
hashCodein classCompositeItem
-
shouldFoldIntoWand
public boolean shouldFoldIntoWand()whether this item should be folded into a parent WeakAndItem -
shouldFoldIntoWand
public void shouldFoldIntoWand(boolean value) set the flag for folding into a parent WeakAndItem
-