Class PredicateQueryItem

All Implemented Interfaces:
TaggableItem, 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
  • Field Details

  • Constructor Details

    • PredicateQueryItem

      public PredicateQueryItem()
  • Method Details

    • setIndexName

      public void setIndexName(String index)
      Sets the name of the index (field) to be used for the predicates.
      Specified by:
      setIndexName in class Item
    • getIndexName

      public String getIndexName()
      Returns the name of the index (field) used for the predicates.
    • addFeature

      public void addFeature(String key, 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(String key, 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(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(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 Collection<PredicateQueryItem.Entry> getFeatures()
      Returns a mutable collection of feature entries.
    • getRangeFeatures

      public 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 String getName()
      Description copied from class: Item
      Returns the name of this item
      Specified by:
      getName in class Item
    • encode

      public int encode(ByteBuffer buffer)
      Specified by:
      encode in class Item
    • getTermCount

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

      public PredicateQueryItem clone()
      Description copied from class: Item
      Returns a deep copy of this item
      Overrides:
      clone in class Item
    • equals

      public boolean equals(Object o)
      Description copied from class: Item
      Returns whether this item is of the same class and contains the same state as the given item.
      Overrides:
      equals in class Item
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Item