Class HitField

java.lang.Object
com.yahoo.prelude.hitfield.HitField

public class HitField extends Object
Represents a tokenized string field in a Hit. The original raw content and the field name cannot be modified. But the tokenized version can be retrieved and set.
Author:
Lars Christian Jensen
  • Constructor Details

    • HitField

      public HitField(String fieldName, String content)
    • HitField

      public HitField(String fieldName, XMLString content)
    • HitField

      public HitField(String fieldName, String content, boolean cjk)
    • HitField

      public HitField(String fieldName, XMLString content, boolean cjk)
      Creates a hit field
      Parameters:
      cjk - true if the content is CJK text
    • HitField

      public HitField(String fieldname, String content, boolean cjk, boolean xmlProperty)
      Creates a hit field
      Parameters:
      fieldname - The field name
      content - The field content
      cjk - true if the content is CJK text
      xmlProperty - true if this should not quote XML syntax
  • Method Details

    • getName

      public String getName()
    • getRawContent

      public String getRawContent()
    • getTokenizedContent

      public List<FieldPart> getTokenizedContent()
      Get a list representation of the tokens in the content. This is only a copy, changes here will not affect the HitField.
      Returns:
      a list containing the content in tokenized form.
    • listIterator

      public ListIterator<FieldPart> listIterator()
      Return an iterator for the tokens, delimiters and markup elements of the field.
    • tokenIterator

      public ListIterator<FieldPart> tokenIterator()
      Return an iterator over the tokens of this field
    • setTokenizedContent

      public void setTokenizedContent(List<FieldPart> list)
      Only FieldPart objects must be present in the list.
      Parameters:
      list - contains the new content of this HitField in tokenized form.
    • getContent

      public String getContent()
      Returns the content of this field
    • getContent

      public String getContent(String boldOpenTag, String boldCloseTag, String separatorTag)
      Returns the content of this field, using the arguments as bolding tags
    • markDirty

      public void markDirty()
    • quotedContent

      public String quotedContent(boolean inAttribute)
      Parameters:
      inAttribute - whether to quote quotation marks
      Returns:
      the content of this field as an XML string
    • quotedContent

      public String quotedContent(String boldOpenTag, String boldCloseTag, String separatorTag, boolean inAttribute)
      Returns the content of this field, using the arguments as bolding tags, as an XML string
    • bareContent

      public String bareContent(boolean XMLQuote, boolean inAttribute)
      Returns the content of the field, stripped of markup
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getOriginal

      public Object getOriginal()
      Fetch the object which (the String representation of) this HitField was built from. This may be null as setting the original is optional.
    • setOriginal

      public void setOriginal(Object original)
      Optionally set the object which this HitField should represent.