'how to count the highlighted words in Algolia search

Hello guys how could I count number of highlighted words in Algolia search including the duplicate word in the same hit



Solution 1:[1]

Algolia only tracks the number of records that match, not the number of highlighted words. You'd have to traverse the hits object yourself to calculate that information based on the <em> tags in each _highlightResult.

What are you using it for?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Chuck Meyer