Package com.yahoo.prelude.query
Class PredicateQueryItem
- java.lang.Object
-
- com.yahoo.prelude.query.Item
-
- com.yahoo.prelude.query.SimpleTaggableItem
-
- com.yahoo.prelude.query.PredicateQueryItem
-
- All Implemented Interfaces:
TaggableItem
,java.lang.Cloneable
public class PredicateQueryItem extends SimpleTaggableItem
A PredicateQueryItem is a collection of feature/value-pairs that are used to query predicate fields, which contains boolean constraints. If the feature/value-pairs from the PredicateQueryItem satisfies the boolean constraints, the document is a match.- Author:
- Magnar Nedland
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PredicateQueryItem.Entry
static class
PredicateQueryItem.EntryBase
static class
PredicateQueryItem.RangeEntry
-
Nested classes/interfaces inherited from class com.yahoo.prelude.query.Item
Item.ItemCreator, Item.ItemType
-
-
Field Summary
Fields Modifier and Type Field Description static long
ALL_SUB_QUERIES
-
Fields inherited from class com.yahoo.prelude.query.Item
connectedBacklink, connectedItem, connectivity, DEFAULT_WEIGHT, explicitSignificance, significance, uniqueID
-
-
Constructor Summary
Constructors Constructor Description PredicateQueryItem()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFeature(PredicateQueryItem.Entry entry)
Adds a feature/value-pair to the predicate query.void
addFeature(java.lang.String key, java.lang.String value)
Adds a feature/value-pair to the predicate query.void
addFeature(java.lang.String key, java.lang.String value, long subQueryBitmap)
Adds a feature/value-pair to the predicate query.void
addRangeFeature(PredicateQueryItem.RangeEntry entry)
Adds a range feature with a given value to the predicate query.void
addRangeFeature(java.lang.String key, long value)
Adds a range feature with a given value to the predicate query.void
addRangeFeature(java.lang.String key, long value, long subQueryBitmap)
Adds a range feature with a given value to the predicate query.protected void
appendBodyString(java.lang.StringBuilder buffer)
Override to append the item body in the canonical query language of this item.PredicateQueryItem
clone()
Returns a deep copy of this itemint
encode(java.nio.ByteBuffer buffer)
java.util.Collection<PredicateQueryItem.Entry>
getFeatures()
java.lang.String
getIndexName()
Item.ItemType
getItemType()
Return the enumerated type of this item.java.lang.String
getName()
Returns the name of this itemjava.util.Collection<PredicateQueryItem.RangeEntry>
getRangeFeatures()
int
getTermCount()
void
setIndexName(java.lang.String index)
Sets the field name to be used for the predicates.-
Methods inherited from class com.yahoo.prelude.query.SimpleTaggableItem
getConnectedItem, getConnectivity, getSignificance, getUniqueID, hasExplicitSignificance, hasUniqueID, setConnectivity, setExplicitSignificance, setSignificance, setUniqueID
-
Methods inherited from class com.yahoo.prelude.query.Item
addAnnotation, appendHeadingString, disclose, encodeThis, equals, getAnnotation, getBytes, getCode, getCreator, getLabel, getLanguage, getParent, getWeight, hasAnnotation, hasConnectivityBackLink, hashCode, isFilter, isFromSpecialToken, isProtected, isRanked, isRoot, putBytes, putString, setCreator, setFilter, setFromSpecialToken, setHasUniqueID, setLabel, setLanguage, setParent, setPositionData, setProtected, setRanked, setWeight, shouldParenthize, toString, usePositionData
-
-
-
-
Field Detail
-
ALL_SUB_QUERIES
public static final long ALL_SUB_QUERIES
- See Also:
- Constant Field Values
-
-
Method Detail
-
setIndexName
public void setIndexName(java.lang.String index)
Sets the field name to be used for the predicates.- Specified by:
setIndexName
in classItem
- Parameters:
index
- name of the field.
-
getIndexName
public java.lang.String getIndexName()
- Returns:
- the field name used for the predicates.
-
addFeature
public void addFeature(java.lang.String key, java.lang.String value)
Adds a feature/value-pair to the predicate query. This feature is applied to all sub queries.- Parameters:
key
- name of the feature to be set in this query.value
- value of the feature.
-
addFeature
public void addFeature(java.lang.String key, java.lang.String value, long subQueryBitmap)
Adds a feature/value-pair to the predicate query.- Parameters:
key
- name of the feature to be set in this query.value
- value of the feature.subQueryBitmap
- bitmap specifying which sub queries this feature applies to.
-
addFeature
public void addFeature(PredicateQueryItem.Entry entry)
Adds a feature/value-pair to the predicate query.- Parameters:
entry
- the feature to add.
-
addRangeFeature
public void addRangeFeature(java.lang.String key, long value)
Adds a range feature with a given value to the predicate query. This feature is applied to all sub queries.- Parameters:
key
- name of the feature to be set in this query.value
- value of the feature.
-
addRangeFeature
public void addRangeFeature(java.lang.String key, long value, long subQueryBitmap)
Adds a range feature with a given value to the predicate query.- Parameters:
key
- name of the feature to be set in this query.value
- value of the feature.subQueryBitmap
- bitmap specifying which sub queries this feature applies to.
-
addRangeFeature
public void addRangeFeature(PredicateQueryItem.RangeEntry entry)
Adds a range feature with a given value to the predicate query.- Parameters:
entry
- the feature to add.
-
getFeatures
public java.util.Collection<PredicateQueryItem.Entry> getFeatures()
- Returns:
- a mutable collection of feature entries.
-
getRangeFeatures
public java.util.Collection<PredicateQueryItem.RangeEntry> getRangeFeatures()
- Returns:
- a mutable collection of range feature entries.
-
getItemType
public Item.ItemType getItemType()
Description copied from class:Item
Return the enumerated type of this item.- Specified by:
getItemType
in classItem
-
getName
public java.lang.String getName()
Description copied from class:Item
Returns the name of this item
-
getTermCount
public int getTermCount()
- Specified by:
getTermCount
in classItem
-
appendBodyString
protected void appendBodyString(java.lang.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.- Specified by:
appendBodyString
in classItem
-
clone
public PredicateQueryItem clone()
Description copied from class:Item
Returns a deep copy of this item
-
-