Package com.yahoo.prelude.query
Class RootItem
java.lang.Object
com.yahoo.prelude.query.Item
com.yahoo.prelude.query.CompositeItem
com.yahoo.prelude.query.RootItem
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
QueryTree
The root node of a query tree. This is always present above the actual semantic root to ease query manipulation,
especially replacing the actual semantic root, but does not have any search semantics on its own.
To ease recursive manipulation of the query tree, this is a composite having one child, which is the actual root.
- Setting the root item (at position 0, either directly or though the iterator of this, works as expected. Setting at any other position is disallowed.
- Removing the root is allowed and causes this to be a null query.
- Adding an item is only allowed if this is currently a null query (having no root)
- Author:
- Arne Bergene Fossaa
-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInserts the item at a position and increases the index of existing items starting on this position by onevoidprotected voidAppends the heading of this string.clone()Returns a deep copy of thisintencode(ByteBuffer buffer) booleanReturns whether this item is of the same class and contains the same state as the given item.Return the enumerated type of this item.getName()Returns the name of this itemgetRoot()Returns the query root.booleanisEmpty()Returns true if this represents the null queryvoidsetIndexName(String index) Sets the index name of all subitems of thisfinal voidai.vespa.searchlib.searchprotocol.protobuf.SearchProtocol.QueryTreeConvert this query tree to protobuf format.Methods inherited from class com.yahoo.prelude.query.CompositeItem
acceptsItemsOfType, adding, appendBodyString, disclose, encodeThis, encodingArity, ensureNotInSubtree, extractSingleChild, getItem, getItemCount, getItemIndex, getItemIterator, getTermCount, hashCode, isLocked, items, lock, removeItem, removeItem, setItem, shouldParenthesizeMethods inherited from class com.yahoo.prelude.query.Item
addAnnotation, getAnnotation, getBytes, getCode, getCreator, getLabel, getLanguage, 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, usePositionData
-
Constructor Details
-
RootItem
public RootItem() -
RootItem
-
-
Method Details
-
setIndexName
Description copied from class:CompositeItemSets the index name of all subitems of this- Overrides:
setIndexNamein classCompositeItem
-
getItemType
Description copied from class:ItemReturn the enumerated type of this item.- Specified by:
getItemTypein classItem
-
getName
Description copied from class:ItemReturns the name of this item -
encode
- Overrides:
encodein classCompositeItem
-
toProtobufQueryTree
public ai.vespa.searchlib.searchprotocol.protobuf.SearchProtocol.QueryTree toProtobufQueryTree()Convert this query tree to protobuf format.- Returns:
- a SearchProtocol.QueryTree protobuf message
-
appendHeadingString
Description copied from class:ItemAppends the heading of this string. As default getName() followed by a space.- Overrides:
appendHeadingStringin classItem
-
getRoot
Returns the query root. This is null if this is a null query. -
setRoot
-
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
-
clone
Returns a deep copy of this- Overrides:
clonein classCompositeItem
-
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
-
isEmpty
public boolean isEmpty()Returns true if this represents the null query
-