Class WordAlternativesItem

All Implemented Interfaces:
BlockItem, HasIndexItem, IndexedItem, TaggableItem, Cloneable

public class WordAlternativesItem extends TermItem
A set of words with differing exactness scores to be used for literal boost ranking.
Author:
Steinar Knutsen
  • Constructor Details

  • Method Details

    • setAlternatives

      public void setAlternatives(Collection<WordAlternativesItem.Alternative> terms)
    • stringValue

      public String stringValue()
      Description copied from interface: BlockItem
      Returns the value of this term as a string
    • isStemmed

      public boolean isStemmed()
    • getNumWords

      public int getNumWords()
      Description copied from interface: HasIndexItem
      Returns how many phrase words does this item contain
    • setValue

      public void setValue(String value)
      Description copied from class: TermItem
      Sets the value of this item from a string.
      Specified by:
      setValue in class TermItem
    • getRawWord

      public String getRawWord()
      Description copied from class: TermItem
      Returns the raw form of the text leading to this term, exactly as received, including original casing
      Specified by:
      getRawWord in interface BlockItem
      Specified by:
      getRawWord in class TermItem
    • isWords

      public boolean isWords()
      Description copied from interface: BlockItem
      Returns whether this item represents normal text
      Specified by:
      isWords in interface BlockItem
      Specified by:
      isWords in class TermItem
    • getIndexedString

      public String getIndexedString()
      Description copied from interface: IndexedItem
      Return the searchable term contents of this item.
      Specified by:
      getIndexedString in interface IndexedItem
      Specified by:
      getIndexedString in class SimpleIndexedItem
      Returns:
      a string representation of what is presumably stored in an index which will match this item
    • 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
    • getAlternatives

      public List<WordAlternativesItem.Alternative> getAlternatives()
      Return an immutable snapshot of the contained terms. This list will not reflect later changes to the item.
      Returns:
      an immutable list of word alternatives and their respective scores
    • encodeThis

      public void encodeThis(ByteBuffer target)
      Overrides:
      encodeThis in class SimpleIndexedItem
    • addTerm

      public void addTerm(String term, double exactness)
      Add a new alternative iff the term string is not already present with an equal or higher exactness score. If the term string is present with a lower exactness score, the new, higher score will take precedence.
      Parameters:
      term - one of several string interpretations of the input word
      exactness - how close the term string matches what the user input
    • clone

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

      public boolean equals(Object other)
      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 TermItem
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class TermItem