Class 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
    • Constructor Detail

      • PredicateQueryItem

        public PredicateQueryItem()
    • Method Detail

      • setIndexName

        public void setIndexName​(java.lang.String index)
        Sets the field name to be used for the predicates.
        Specified by:
        setIndexName in class Item
        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 class Item
      • getName

        public java.lang.String getName()
        Description copied from class: Item
        Returns the name of this item
        Specified by:
        getName in class Item
      • encode

        public int encode​(java.nio.ByteBuffer buffer)
        Specified by:
        encode in class Item
      • getTermCount

        public int getTermCount()
        Specified by:
        getTermCount in class Item
      • 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 class Item