Class WeakAndItem

  • All Implemented Interfaces:
    java.lang.Cloneable

    public final class WeakAndItem
    extends NonReducibleCompositeItem
    Weak And of a collection of sub-expressions: this behaves like an OR unless many hits are returned and then it starts acting more like an AND. Alternately it can be viewed as an n-of-m operator where n is 1 at first and then increases gradually to m as more hits are seen.
    Author:
    arnej27959
    • Field Detail

      • defaultN

        public static final int defaultN
        The default N used if none is specified: 100
        See Also:
        Constant Field Values
    • Constructor Detail

      • WeakAndItem

        public WeakAndItem​(java.lang.String index,
                           int N)
        Make a WAND item with no children. You can mention a common index or you can mention it on each child.
        Parameters:
        index - The index it shall search.
        N - the target for minimum number of hits to produce; a backend will not suppress any hits in the operator until N hits have been produced.
      • WeakAndItem

        public WeakAndItem​(int N)
      • WeakAndItem

        public WeakAndItem()
        Creates a WAND item with default N
    • Method Detail

      • 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
      • setIndexName

        public void setIndexName​(java.lang.String index)
        Sets the index name of all subitems of this
        Overrides:
        setIndexName in class CompositeItem
      • getIndexName

        public java.lang.String getIndexName()
      • appendHeadingString

        protected void appendHeadingString​(java.lang.StringBuilder buffer)
        Appends the heading of this string - [getName()]([limit])
        Overrides:
        appendHeadingString in class Item
      • getN

        public int getN()
      • setN

        public void setN​(int N)
      • getScoreThreshold

        public int getScoreThreshold()
      • setScoreThreshold

        public void setScoreThreshold​(int scoreThreshold)
        Sets the score threshold used by the backend search operator handling this WeakAndItem. This threshold is currently only used if the WeakAndItem is searching a RISE index field. The score threshold then specifies the minimum dot product score a match needs to be part of the result set. Default value is 0.
        Parameters:
        scoreThreshold - the score threshold.
      • encodeThis

        protected void encodeThis​(java.nio.ByteBuffer buffer)
        Description copied from class: CompositeItem
        Encodes just this item, not it's usual subitems, to the given buffer.
        Overrides:
        encodeThis in class CompositeItem
      • disclose

        public void disclose​(com.yahoo.prelude.query.textualrepresentation.Discloser discloser)
        Overrides:
        disclose in class CompositeItem
      • equals

        public boolean equals​(java.lang.Object object)
        Returns whether this item is of the same class and contains the same state as the given item
        Overrides:
        equals in class CompositeItem