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

Current API clients

Set default tag

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

Set default tag

IndexSettings settings = new IndexSettings()
settings.HighlightPostTag = "";

index.SetSettings(settings);

Change default tag for the current search

index.Search(new Query("query")
{
    HighlightPostTag = ""
});
I