Class BoolItem

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

public class BoolItem extends TermItem
A true/false term suitable for searching bool indexes.
Author:
bratseth
  • Constructor Details

    • BoolItem

      public BoolItem(boolean value)
    • BoolItem

      public BoolItem(boolean value, String indexName)
    • BoolItem

      public BoolItem(boolean value, String indexName, boolean isFromQuery)
  • Method Details

    • getItemType

      public Item.ItemType getItemType()
      Returns ItemType.WORD as we do not want a string binding from the parsed query to index types
      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
    • encodeThis

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

      public boolean value()
    • stringValue

      public String stringValue()
      Returns "true" or "false"
    • setValue

      public void setValue(boolean value)
    • setValue

      public void setValue(String stringValue)
      Sets the value from a string
      Specified by:
      setValue in class TermItem
      Parameters:
      stringValue - "true" or "false"
      Throws:
      IllegalArgumentException - if the given value is not equal to "true" nor "false" (ignoring case)
    • getRawWord

      public String getRawWord()
      Returns the same as stringValue
      Specified by:
      getRawWord in interface BlockItem
      Specified by:
      getRawWord in class TermItem
    • isStemmed

      public boolean isStemmed()
    • appendHeadingString

      protected void appendHeadingString(StringBuilder buffer)
      Word items uses a empty heading instead of "WORD "
      Overrides:
      appendHeadingString in class Item
    • hashCode

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

      public boolean equals(Object object)
      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
    • 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