Page tree
Skip to end of metadata
Go to start of metadata

The Teaser  field expression can be used for applying highlighting to any arbitrary field. 



    • 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
    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



    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 ParameterSchema Field PropertyTypeDefault ValueDescription
    highlightModenoneenum[RAW, TEXT, XML, HTML]HTMLThe 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.
    fallbackhighlight.fallbackFieldStringnullThe name of a field to return in the event no highlights are found.
    If not specified, the source field will be used for fallback.


    booleanfalseIf true, the text for the source field will be fragmented, returning the best fragments.
    fragmentScopehighlight.fragmentScopeStringnullThe name of a scope to use for selecting fragments if fragment is true.
    numFragmentshighlight.numFragmentsinteger3Number of fragments to return if fragment is true.
    fragmentSizehighlight.fragmentSizeinteger100Target 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.
    mergeFragmentshighlight.mergeFragmentsbooleantrueIf 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.
    separatorhighlight.separatorString...Separator string to use to join fragments if fragment is true and mergeFragments is true.
    matchScopenoneStringnullScope to use for annotating atomic matches in the result.
    Atomic matches are the individual terms that matched, regardless of phrasing present in query.
    tokenizerindex.tokenizerStringdefaultThe name of the tokenizer to use for highlighting if index based highlighting is not available.
    whitelisthighlight.whitelistStringnullComma separated list of field names used to extract query terms from the search query.
    • No labels