Skip to main content
The highlightPostTag parameter defines the HTML tag inserted after the matching text in highlighted attributes. It works in combination with highlightPreTag, which marks the beginning of the highlighted portion.

Usage

  • Set an empty string ("") to fallback to the default tag.
  • To turn off highlighting, remove the searchable attribute with the attributesToHighlight parameter.

Examples

Set default tag

Current API clients

var response = await client.SetSettingsAsync(
  "ALGOLIA_INDEX_NAME",
  new IndexSettings { HighlightPostTag = "</em>" }
);
IndexSettings settings = new IndexSettings()
settings.HighlightPostTag = "";

index.SetSettings(settings);

Current API clients

var response = await client.SearchSingleIndexAsync<Hit>(
  "ALGOLIA_INDEX_NAME",
  new SearchParams(new SearchParamsObject { Query = "query", HighlightPostTag = "</strong>" })
);
index.Search(new Query("query")
{
    HighlightPostTag = ""
});