Skip to main content

Documentation Index

Fetch the complete documentation index at: https://algolia.com/llms.txt

Use this file to discover all available pages before exploring further.

The highlightPreTag parameter defines the HTML tag inserted before the matching text in highlighted attributes. It works in combination with highlightPostTag, which marks the end 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(
  "INDEX_NAME",
  new IndexSettings { HighlightPreTag = "<em>" }
);
IndexSettings settings = new IndexSettings()
settings.HighlightPreTag = "";

index.SetSettings(settings);

Current API clients

var response = await client.SearchSingleIndexAsync<Hit>(
  "INDEX_NAME",
  new SearchParams(new SearchParamsObject { Query = "query", HighlightPreTag = "<strong>" })
);
index.Search(new Query("query")
{
    HighlightPreTag = ""
});
Last modified on March 23, 2026