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 WeakAnd item with no children. You can mention a common index or you can mention it on each child.
        Parameters:
        index - the index to 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

        @Deprecated
        public int getScoreThreshold()
        Deprecated.
      • setScoreThreshold

        @Deprecated
        public void setScoreThreshold​(int scoreThreshold)
        Deprecated.
        has no effect
        Noop.
      • 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