Package com.yahoo.prelude.hitfield
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 Summary
Constructors Constructor Description HitField(String fieldName, XMLString content)
HitField(String fieldName, XMLString content, boolean cjk)
Creates a hit fieldHitField(String fieldName, String content)
HitField(String fieldName, String content, boolean cjk)
HitField(String fieldname, String content, boolean cjk, boolean xmlProperty)
Creates a hit field
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
bareContent(boolean XMLQuote, boolean inAttribute)
Returns the content of the field, stripped of markupString
getContent()
Returns the content of this fieldString
getContent(String boldOpenTag, String boldCloseTag, String separatorTag)
Returns the content of this field, using the arguments as bolding tagsString
getName()
Object
getOriginal()
Fetch the object which (the String representation of) this HitField was built from.String
getRawContent()
List<FieldPart>
getTokenizedContent()
Get a list representation of the tokens in the content.ListIterator<FieldPart>
listIterator()
Return an iterator for the tokens, delimiters and markup elements of the field.void
markDirty()
String
quotedContent(boolean inAttribute)
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 stringvoid
setOriginal(Object original)
Optionally set the object which this HitField should represent.void
setTokenizedContent(List<FieldPart> list)
Only FieldPart objects must be present in the list.ListIterator<FieldPart>
tokenIterator()
Return an iterator over the tokens of this fieldString
toString()
-
-
-
Method Detail
-
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
-
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.
-
-