HomeDev guideRecipesAPI Reference
Dev guideUser GuidesLegal TermsNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Highlight

Highlight your search keywords in search results.

👍

Beta

The Optimizely Graph .NET Client is in beta. Contact your Customer Success Manager for information.

To build a search query with highlighted snippets in Optimizely Graph, the Optimizely Graph .NET Client provides HightLightOptions for searchable fields.

query.Field(x=> x.SearchableField, HighLightOptions.Create().Enable(true).StartToken("<b>").EndToken("</b>"))
     .Filter(x=> x.SearchableField.Match("your_key_words"))

To enable highlighting, set the Enable method to true. The parameter must be boolean.

StartToken and EndToken wrap your matched keywords. The previous example wraps your matched keywords in the HTML tags <b> and </b> to make the text bold.