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

The ScopeTeaser  field expression is a subclass of Teaser intended to make it easier to enable scope-based highlighting. ScopeTeaser applies highlighting to any arbitrary field/expression, just like Teaser, but it also encloses the highlighted segment in a "snippet" of relevant text that is determined by the extent of a named scope. 

When scope highlighting is turned on for the "sentence" scope, the snippet contains the full sentence around the matching phrase:

Search Response Value
 <sentence>Injured Suarez to miss <location><b>Liverpool</b></location> trip</sentence>

If we change the settings to retrieve the "location" scope instead, the resulting snippet is much smaller:

Search Response Value
 <location><b>Liverpool</b></location>



    SCOPETEASER(FIELDEXPRESSION, PARAMETERS)

    • FIELDEXPRESSION - field expression to apply teaser to
    • PARAMETERS - optional comma separated list of parameters to apply to matching fields function
    SCOPETEASER(title, fragmentScope=sentence, highlightMode=xml) AS sentences
    import com.attivio.sdk.search.HighlightMode;
    import com.attivio.sdk.search.fields.ScopeTeaser;
     
    ScopeTeaser teaser = new ScopeTeaser(HighlightMode.XML,"title","sentence");


    Parameters

    The ScopeTeaser field expression supports all the same parameters as the Teaser field expression, with the only difference being that ScopeTeaser will always fragment text by default, according to the specified fragmentScope.

     

    • No labels