public class PhraseSegmentItem extends IndexedSegmentItem
Item.ItemCreator, Item.ItemType
Modifier and Type | Field and Description |
---|---|
private boolean |
explicit
Whether this was explicitly written as a phrase using quotes by the user
|
connectedBacklink, connectedItem, connectivity, DEFAULT_WEIGHT, explicitSignificance, significance, uniqueID
Constructor and Description |
---|
PhraseSegmentItem(AndSegmentItem segAnd)
Creates a phrase containing the same words and state (as pertinent) as
the given SegmentAndItem.
|
PhraseSegmentItem(String rawWord,
boolean isFromQuery,
boolean stemmed) |
PhraseSegmentItem(String rawWord,
String current,
boolean isFromQuery,
boolean stemmed)
Creates a phrase segment from strings
|
PhraseSegmentItem(String rawWord,
String current,
boolean isFromQuery,
boolean stemmed,
Substring substring) |
Modifier and Type | Method and Description |
---|---|
void |
addItem(Item item)
Adds subitem.
|
private void |
addWordItem(WordItem word) |
protected void |
appendBodyString(StringBuilder buffer)
Override to append the item body in the canonical query language of this item.
|
(package private) void |
appendContentsString(StringBuilder buffer) |
protected void |
appendHeadingString(StringBuilder buffer)
Segment phrase items uses a empty heading instead of "SPHRASE "
|
void |
disclose(Discloser discloser) |
int |
encode(ByteBuffer buffer) |
int |
encodeContent(ByteBuffer buffer) |
private int |
encodeContent(ByteBuffer buffer,
int itemCount) |
protected void |
encodeThis(ByteBuffer buffer)
Encodes just this item, not it's usual subitems, to the given buffer.
|
boolean |
equals(Object object)
Returns whether this item is of the same class and
contains the same state as the given item
|
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 item
|
WordItem |
getWordItem(int index)
Returns a subitem as a word item
|
boolean |
isExplicit() |
void |
setExplicit(boolean explicit) |
void |
setIndexName(String index)
Sets the name of the index to search
|
void |
setWeight(int weight)
Sets the relative importance of this term
|
protected boolean |
shouldParenthize()
Returns false, no parenthezes for phrases
|
appendIndexString, getIndexName, hashCode
getConnectedItem, getConnectivity, getSignificance, getUniqueID, hasExplicitSignificance, hasUniqueID, setConnectivity, setExplicitSignificance, setSignificance, setUniqueID
addItem, clone, getNormalized, getNumWords, getOrigin, getRawWord, getSegmentingRule, isFromQuery, isFromUser, isLocked, isStemmed, isWords, lock, removeItem, removeItem, setFromUser, setSegmentingRule, stringValue
adding, encodingArity, ensureNotInSubtree, getItem, getItemCount, getItemIndex, getItemIterator, getTermCount, insertNullFirstItem, setItem
addAnnotation, 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, toString, usePositionData
finalize, getClass, notify, notifyAll, wait, wait, wait
getNumWords
private boolean explicit
public PhraseSegmentItem(AndSegmentItem segAnd)
public PhraseSegmentItem(String rawWord, boolean isFromQuery, boolean stemmed)
public PhraseSegmentItem(String rawWord, String current, boolean isFromQuery, boolean stemmed)
rawWord
- the raw text as received in the requestcurrent
- the normalized form of the raw text, or the raw text repeated if no normalized form is knownisFromQuery
- whether this originates in the requeststemmed
- whether this is stemmedpublic Item.ItemType getItemType()
Item
getItemType
in class Item
public void setIndexName(String index)
IndexedSegmentItem
setIndexName
in interface IndexedItem
setIndexName
in class IndexedSegmentItem
public void setWeight(int weight)
Item
public void addItem(Item item)
addItem
in class SegmentItem
IllegalArgumentException
- if the given item is not a WordItem or PhraseItemprivate void addWordItem(WordItem word)
public WordItem getWordItem(int index)
index
- the (0-base) index of the item to returnIndexOutOfBoundsException
- if there is no subitem at indexprotected void encodeThis(ByteBuffer buffer)
CompositeItem
encodeThis
in class IndexedSegmentItem
public int encode(ByteBuffer buffer)
encode
in class CompositeItem
public int encodeContent(ByteBuffer buffer)
private int encodeContent(ByteBuffer buffer, int itemCount)
protected boolean shouldParenthize()
shouldParenthize
in class CompositeItem
protected void appendHeadingString(StringBuilder buffer)
appendHeadingString
in class Item
protected void appendBodyString(StringBuilder buffer)
Item
([itemName] [body])The body must be appended appended by this method.
appendBodyString
in class CompositeItem
void appendContentsString(StringBuilder buffer)
public boolean equals(Object object)
CompositeItem
equals
in class IndexedSegmentItem
public String getIndexedString()
IndexedItem
getIndexedString
in interface IndexedItem
getIndexedString
in class IndexedSegmentItem
public boolean isExplicit()
public void setExplicit(boolean explicit)
public void disclose(Discloser discloser)
disclose
in class IndexedSegmentItem
Copyright © 2018. All rights reserved.