Class TermItem

All Implemented Interfaces:
BlockItem, HasIndexItem, IndexedItem, TaggableItem, Cloneable
Direct Known Subclasses:
BoolItem, FuzzyItem, GeoLocationItem, IntItem, RegExpItem, WordAlternativesItem, WordItem

public abstract class TermItem extends SimpleIndexedItem implements BlockItem
Superclass of "leaf" conditions containing a single entity which is either matched in a field or not.
Author:
bratseth, havardpe
  • Constructor Details

    • TermItem

      public TermItem()
    • TermItem

      public TermItem(String indexName)
    • TermItem

      public TermItem(String indexName, boolean isFromQuery)
    • TermItem

      protected TermItem(String indexName, boolean isFromQuery, Substring origin)
  • Method Details

    • encode

      public final int encode(ByteBuffer buffer)
      Specified by:
      encode in class Item
    • appendBodyString

      protected final void appendBodyString(StringBuilder buffer)
      Appends the index prefix if necessary and delegates to the subclass
      Specified by:
      appendBodyString in class Item
    • setValue

      public abstract void setValue(String value)
      Sets the value of this item from a string.
      Throws:
      UnsupportedOperationException - if this is not supported on this kind of item
    • getRawWord

      public abstract String getRawWord()
      Returns the raw form of the text leading to this term, exactly as received, including original casing
      Specified by:
      getRawWord in interface BlockItem
    • getOrigin

      public Substring getOrigin()
      Returns the substring which is the raw form of the text leading to this token. This substring also contains the superstring this substring was a part of, e.g the whole query string. If this did not originate directly from a user string, this is null.
      Specified by:
      getOrigin in interface BlockItem
    • isFromQuery

      public boolean isFromQuery()
      Whether this term is from the query or has been added by a searcher. Only terms from the user should be modified by query rewriters which attempts to improve the precision or recall of the user's query.
      Specified by:
      isFromQuery in interface BlockItem
    • setFromQuery

      public void setFromQuery(boolean isFromQuery)
    • isWords

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

      public void setOrigin(Substring origin)
      Sets the origin of this
    • disclose

      public void disclose(Discloser discloser)
      Overrides:
      disclose in class SimpleIndexedItem
    • getTermCount

      public int getTermCount()
      Specified by:
      getTermCount in class Item
    • isNormalizable

      public boolean isNormalizable()
      Returns whether accent removal is a meaningful and possible operation for this word.
    • setNormalizable

      public void setNormalizable(boolean normalizable)
      Sets whether accent removal is a meaningful and possible operation for this word.
      Parameters:
      normalizable - set to true if accent removal can/should be performed
    • getSegmentingRule

      public SegmentingRule getSegmentingRule()
      Description copied from interface: BlockItem
      If the block has to be resegmented, what operator should be chosen if it is necessary to change operator?
      Specified by:
      getSegmentingRule in interface BlockItem
    • setSegmentingRule

      public void setSegmentingRule(SegmentingRule segmentingRule)
    • 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 SimpleIndexedItem
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class SimpleIndexedItem