The Teaser field expression can be used for applying highlighting to any arbitrary field.
TEASER(FIELDEXPRESSION, PARAMETERS)
- FIELDEXPRESSION - field expression to apply teaser to
- PARAMETERS - optional comma separated list of parameters to apply to matching fields function
TEASER(title, fragment=false) AS title
import com.attivio.sdk.search.fields.Teaser; import com.attivio.sdk.search.fields.StoredField; Teaser teaser = new Teaser(new StoredField("title"), "title"); // returned field will be named "title" teaser.setFragment(false); // don't fragment field value prior to highlighting // set additional parameters as needed
Parameters
The Teaser field expression can be configured via numerous parameters to control how highlighting is performed. If the source field for the Teaser expression is a schema field, it will use the schema default value by default, otherwise, it will use the default specified below. See Field Properties for more information on configuring schema field properties on a per-field basis.
REST Parameter | Schema Field Property | Type | Default Value | Description |
---|---|---|---|---|
highlightMode | none | enum[RAW, TEXT, XML, HTML] | HTML | The mode for applying highlights. If highlight mode is not specified, the default highlight mode for the query request will be used, which is HTML by default. |
fallback | highlight.fallbackField | String | null | The name of a field to return in the event no highlights are found. If not specified, the source field will be used for fallback. |
fragment | highlight.fragment | boolean | false | If true, the text for the source field will be fragmented, returning the best fragments. |
fragmentScope | highlight.fragmentScope | String | null | The name of a scope to use for selecting fragments if fragment is true. |
numFragments | highlight.numFragments | integer | 3 | Number of fragments to return if fragment is true. |
fragmentSize | highlight.fragmentSize | integer | 100 | Target size for fragments when fragment is true. This will only be used if fragmentScope is not specified, or if fragmentScope refers to a scope not present in the source field. |
mergeFragments | highlight.mergeFragments | boolean | true | If true, and fragment is true, fragments will be merged into a single field value using separator as a delimiter. If false, each fragment will be returned as a separate field value. |
separator | highlight.separator | String | ... | Separator string to use to join fragments if fragment is true and mergeFragments is true. |
matchScope | none | String | null | Scope to use for annotating atomic matches in the result. Atomic matches are the individual terms that matched, regardless of phrasing present in query. |
tokenizer | index.tokenizer | String | default | The name of the tokenizer to use for highlighting if index based highlighting is not available. |
whitelist | highlight.whitelist | String | null | Comma separated list of field names used to extract query terms from the search query. |