Skip to main content
Autocomplete is also available as an experimental widget in InstantSearch, making it easier to integrate into your search experience. For more information, see the API reference for InstantSearch.js or React InstantSearch.
The parseAlgoliaHitReverseHighlight function lets you parse the non-highlighted parts of an Algolia hit. This is a common pattern for Query Suggestions, where you want to highlight the differences between each suggestion.
If youโ€™re using autocomplete-js, all Algolia utilities are available directly in the package with the right user agents and the virtual DOM layer. You donโ€™t need to import the preset separately.

Installation

First, you need to install the preset.
Then import it in your project:
JavaScript
If you donโ€™t use a package manager, you can use the HTML script element:
HTML

Examples

With a single string

JavaScript

With nested attributes

JavaScript

Parameters

AlgoliaHit
The Algolia hit whose attribute to retrieve the reverse highlighted parts from.
string | string[]
The attribute to retrieve the reverse highlighted parts from. You can use the array syntax to reference nested attributes.

Returns

ParsedAttribute[]
An array of the parsed attributeโ€™s parts.
Last modified on May 19, 2026