Class WeakAndItem

All Implemented Interfaces:
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 Details

    • defaultN

      public static final int defaultN
      The default N used if none is specified: 100
      See Also:
  • Constructor Details

    • WeakAndItem

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

      public WeakAndItem(int N)
    • WeakAndItem

      public WeakAndItem(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.
  • Method Details

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

      public void setIndexName(String index)
      Sets the default index name to apply to all child items of this. This is useful in conjunction with using PureWeightedItems as children.
      Overrides:
      setIndexName in class CompositeItem
    • getIndexName

      public String getIndexName()
      Returns the index name set for this, or null if none.
    • appendHeadingString

      protected void appendHeadingString(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(ByteBuffer buffer)
      Description copied from class: CompositeItem
      Encodes just this item, not its regular subitems, to the given buffer.
      Overrides:
      encodeThis in class CompositeItem
    • disclose

      public void disclose(Discloser discloser)
      Overrides:
      disclose in class CompositeItem
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class CompositeItem
    • equals

      public boolean equals(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