public class PhraseItem extends CompositeIndexedItem
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 |
---|
PhraseItem()
Creates an empty phrase
|
PhraseItem(String indexName)
Creates an empty phrase which will search the given index
|
PhraseItem(String[] words)
Creates a phrase containing the given words
|
Modifier and Type | Method and Description |
---|---|
private void |
addIndexedItem(IndexedItem word) |
private void |
addIndexedItem(int index,
IndexedItem word) |
void |
addItem(int index,
Item item)
Inserts the item at a position and increases the index of existing items
starting on this position by one
|
void |
addItem(Item item)
Adds subitem.
|
protected void |
appendBodyString(StringBuilder buffer)
Override to append the item body in the canonical query language of this item.
|
protected void |
appendHeadingString(StringBuilder buffer)
Phrase items uses a empty heading instead of "PHRASE "
|
private IndexedItem |
convertIntToWord(Item orig) |
void |
disclose(Discloser discloser) |
int |
encode(ByteBuffer buffer) |
protected void |
encodeThis(ByteBuffer buffer)
Encodes just this item, not it's usual subitems, to the given buffer.
|
protected int |
encodingArity() |
BlockItem |
getBlockItem(int index)
Returns a subitem as a block 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
|
int |
getNumWords() |
WordItem |
getWordItem(int index)
Returns a subitem as a word item
|
boolean |
isExplicit()
Returns whether this was explicitly written as a phrase using quotes by
the user Default is false
|
void |
setExplicit(boolean explicit)
Sets whether this was explicitly written as a phrase using quotes by the
user
|
private Item |
setIndexedItem(int index,
IndexedItem word) |
void |
setIndexName(String index)
Sets the name of the index to search
|
Item |
setItem(int index,
Item item)
Replaces the item at the given index
|
protected boolean |
shouldParenthize()
Returns false, no parenthezes for phrases
|
appendIndexString, equals, getIndexName, hashCode
getConnectedItem, getConnectivity, getSignificance, getUniqueID, hasExplicitSignificance, hasUniqueID, setConnectivity, setExplicitSignificance, setSignificance, setUniqueID
adding, clone, ensureNotInSubtree, getItem, getItemCount, getItemIndex, getItemIterator, getTermCount, insertNullFirstItem, isLocked, lock, removeItem, removeItem
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, setWeight, toString, usePositionData
private boolean explicit
public PhraseItem()
public PhraseItem(String indexName)
public PhraseItem(String[] words)
public Item.ItemType getItemType()
Item
getItemType
in class Item
public void setIndexName(String index)
CompositeIndexedItem
setIndexName
in interface IndexedItem
setIndexName
in class CompositeIndexedItem
public void setExplicit(boolean explicit)
public boolean isExplicit()
private IndexedItem convertIntToWord(Item orig)
public void addItem(Item item)
addItem
in class CompositeItem
IllegalArgumentException
- if the given item is not a WordItem or PhraseItempublic void addItem(int index, Item item)
CompositeItem
addItem
in class CompositeItem
public Item setItem(int index, Item item)
CompositeItem
setItem
in class CompositeItem
index
- the (0-base) index of the item to replaceitem
- the new itemprivate void addIndexedItem(IndexedItem word)
private void addIndexedItem(int index, IndexedItem word)
private Item setIndexedItem(int index, IndexedItem word)
public WordItem getWordItem(int index)
index
- the (0-base) index of the item to returnIndexOutOfBoundsException
- if there is no subitem at indexpublic BlockItem getBlockItem(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 CompositeIndexedItem
public int encode(ByteBuffer buffer)
encode
in class CompositeItem
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
public String getIndexedString()
IndexedItem
getIndexedString
in interface IndexedItem
getIndexedString
in class CompositeIndexedItem
protected int encodingArity()
encodingArity
in class CompositeItem
public int getNumWords()
public void disclose(Discloser discloser)
disclose
in class CompositeIndexedItem
Copyright © 2018. All rights reserved.