Package com.yahoo.prelude.hitfield
Class HitField
java.lang.Object
com.yahoo.prelude.hitfield.HitField
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
ConstructorDescriptionCreates a hit fieldCreates a hit field -
Method Summary
Modifier and TypeMethodDescriptionbareContent
(boolean XMLQuote, boolean inAttribute) Returns the content of the field, stripped of markupReturns the content of this fieldgetContent
(String boldOpenTag, String boldCloseTag, String separatorTag) Returns the content of this field, using the arguments as bolding tagsgetName()
Fetch the object which (the String representation of) this HitField was built from.Get a list representation of the tokens in the content.Return an iterator for the tokens, delimiters and markup elements of the field.void
quotedContent
(boolean inAttribute) 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.Return an iterator over the tokens of this fieldtoString()
-
Constructor Details
-
HitField
-
HitField
-
HitField
-
HitField
Creates a hit field- Parameters:
cjk
- true if the content is CJK text
-
HitField
Creates a hit field- Parameters:
fieldname
- The field namecontent
- The field contentcjk
- true if the content is CJK textxmlProperty
- true if this should not quote XML syntax
-
-
Method Details
-
getName
-
getRawContent
-
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
Return an iterator for the tokens, delimiters and markup elements of the field. -
tokenIterator
Return an iterator over the tokens of this field -
setTokenizedContent
Only FieldPart objects must be present in the list.- Parameters:
list
- contains the new content of this HitField in tokenized form.
-
getContent
Returns the content of this field -
getContent
Returns the content of this field, using the arguments as bolding tags -
markDirty
public void markDirty() -
quotedContent
- 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
Returns the content of the field, stripped of markup -
toString
-
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
Optionally set the object which this HitField should represent.
-