Package com.yahoo.search.query
Class QueryTree
java.lang.Object
com.yahoo.prelude.query.Item
com.yahoo.prelude.query.CompositeItem
com.yahoo.prelude.query.RootItem
com.yahoo.search.query.QueryTree
- All Implemented Interfaces:
Cloneable
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)
This is also the home of accessor methods which eases querying into and manipulation of the query tree.
- 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 TypeMethodDescriptionModifies this query to become the current query AND the given item.clone()Returns a deep copy of thisbooleanReturns whether this item is of the same class and contains the same state as the given item.static List<IndexedItem>getPositiveTerms(Item item) Returns a flattened list of all positive query terms under the given iteminttreeSize()Returns the total number of items in this query tree.Modifies this query to become the current query RANK with the given item.Methods inherited from class com.yahoo.prelude.query.RootItem
addItem, addItem, appendHeadingString, encode, getItemType, getName, getRoot, isEmpty, setIndexName, setRoot, toProtobufQueryTreeMethods 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
-
QueryTree
public QueryTree() -
QueryTree
-
-
Method Details
-
equals
Description copied from class:CompositeItemReturns whether this item is of the same class and contains the same state as the given item. -
clone
Returns a deep copy of this -
withRank
Modifies this query to become the current query RANK with the given item.- Returns:
- the resulting root item in this
-
and
Modifies this query to become the current query AND the given item.- Returns:
- the resulting root item in this
-
getPositiveTerms
Returns a flattened list of all positive query terms under the given item -
treeSize
public int treeSize()Returns the total number of items in this query tree.
-