Package com.yahoo.prelude.query
Class SameElementItem
- java.lang.Object
-
- com.yahoo.prelude.query.Item
-
- com.yahoo.prelude.query.CompositeItem
-
- com.yahoo.prelude.query.NonReducibleCompositeItem
-
- com.yahoo.prelude.query.SameElementItem
-
- All Implemented Interfaces:
Cloneable
public class SameElementItem extends NonReducibleCompositeItem
This represents a query where all terms are required to match in the same element id. The primary usecase is to allow efficient search in arrays and maps of struct. The common path is the field name containing the struct.- Author:
- baldersheim
-
-
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 SameElementItem(String commonPath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
adding(Item item)
protected void
appendBodyString(StringBuilder buffer)
Override to append the item body in the canonical query language of this item.protected void
appendHeadingString(StringBuilder buffer)
Appends the heading of this string.protected void
encodeThis(ByteBuffer buffer)
Encodes just this item, not it's usual subitems, to the given buffer.boolean
equals(Object other)
Returns whether this item is of the same class and contains the same state as the given itemOptional<Item>
extractSingleChild()
Will return its single child if itself can safely be omitted.String
getFieldName()
Item.ItemType
getItemType()
Return the enumerated type of this item.String
getName()
Returns the name of this itemint
hashCode()
-
Methods inherited from class com.yahoo.prelude.query.CompositeItem
addItem, addItem, clone, disclose, encode, encodingArity, ensureNotInSubtree, getItem, getItemCount, getItemIndex, getItemIterator, getTermCount, isLocked, items, lock, removeItem, removeItem, setIndexName, setItem, shouldParenthize
-
Methods inherited from class com.yahoo.prelude.query.Item
addAnnotation, getAnnotation, getBytes, getCode, getCreator, getLabel, getLanguage, 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
-
-
-
-
Constructor Detail
-
SameElementItem
public SameElementItem(String commonPath)
-
-
Method Detail
-
encodeThis
protected void encodeThis(ByteBuffer buffer)
Description copied from class:CompositeItem
Encodes just this item, not it's usual subitems, to the given buffer.- Overrides:
encodeThis
in classCompositeItem
-
appendHeadingString
protected void appendHeadingString(StringBuilder buffer)
Description copied from class:Item
Appends the heading of this string. As default getName() followed by a space.- Overrides:
appendHeadingString
in classItem
-
appendBodyString
protected void appendBodyString(StringBuilder buffer)
Description copied from class:Item
Override to append the item body in the canonical query language of this item. An item is usually represented by the string([itemName] [body])
The body must be appended appended by this method.- Overrides:
appendBodyString
in classCompositeItem
-
adding
protected void adding(Item item)
- Overrides:
adding
in classCompositeItem
-
extractSingleChild
public Optional<Item> extractSingleChild()
Description copied from class:CompositeItem
Will return its single child if itself can safely be omitted.- Overrides:
extractSingleChild
in classNonReducibleCompositeItem
- Returns:
- a valid Item or empty Optional if it can not be done
-
getItemType
public Item.ItemType getItemType()
Description copied from class:Item
Return the enumerated type of this item.- Specified by:
getItemType
in classItem
-
getFieldName
public String getFieldName()
-
equals
public boolean equals(Object other)
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
-
-