Class WordItem

All Implemented Interfaces:
BlockItem, HasIndexItem, IndexedItem, TaggableItem, Cloneable
Direct Known Subclasses:
ExactStringItem, MarkerWordItem, PrefixItem, SubstringItem, SuffixItem

public class WordItem extends TermItem
A simple word or token to match in some field.
Author:
bratseth, havardpe
  • Constructor Details

    • WordItem

      public WordItem(String word)
    • WordItem

      public WordItem(String word, String indexName)
    • WordItem

      public WordItem(String word, boolean isFromQuery)
    • WordItem

      public WordItem(String word, String indexName, boolean isFromQuery)
    • WordItem

      public WordItem(Token word, boolean isFromQuery)
    • WordItem

      public WordItem(String word, boolean isFromQuery, Substring origin)
    • WordItem

      public WordItem(String word, String indexName, boolean isFromQuery, Substring origin)
  • 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
    • setWord

      public void setWord(String word)
    • encodeThis

      protected void encodeThis(ByteBuffer buffer)
      Overrides:
      encodeThis in class SimpleIndexedItem
    • getEncodedWord

      protected String getEncodedWord()
      Returns the word for encoding. By default simply the word
    • getWord

      public String getWord()
      Returns the same as stringValue()
    • stringValue

      public String stringValue()
      Returns this word as it should be used in executing the query. This is usually (but not always) a normalized and stemmed form
    • setValue

      public void setValue(String value)
      Same as #setWord
      Specified by:
      setValue in class TermItem
    • getRawWord

      public String getRawWord()
      Get the word exactly as received in the request. This returns the same as getWord if no other raw form is known
      Specified by:
      getRawWord in interface BlockItem
      Specified by:
      getRawWord in class TermItem
      Returns:
      the raw form of this word, never null
    • isStemmed

      public boolean isStemmed()
    • setStemmed

      public void setStemmed(boolean stemmed)
    • isFromSegmented

      public boolean isFromSegmented()
    • setFromSegmented

      public void setFromSegmented(boolean fromSegmented)
    • isLowercased

      public boolean isLowercased()
    • setLowercased

      public void setLowercased(boolean lowercased)
    • getSegmentIndex

      public int getSegmentIndex()
    • setSegmentIndex

      public void setSegmentIndex(int segmentIndex)
    • appendHeadingString

      protected void appendHeadingString(StringBuilder buffer)
      Word items uses a empty heading instead of "WORD "
      Overrides:
      appendHeadingString 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 TermItem
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class TermItem
    • getNumWords

      public int getNumWords()
      Description copied from interface: HasIndexItem
      Returns how many phrase words does this item contain
    • 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
    • isWords

      public boolean isWords()
      Returns true if this consists of regular word characters. Returns false if this represents a "special token"
      Specified by:
      isWords in interface BlockItem
      Specified by:
      isWords in class TermItem
    • setWords

      public void setWords(boolean words)
      Sets if this consists of regular word characters (true) or represents a "special token" (false)
    • disclose

      public void disclose(Discloser discloser)
      Overrides:
      disclose in class TermItem