Get count of hits/results; instantsearch.js

Hi all,

Trying to get a count of the hits returned from a search using instantsearch.js.

In the instantsearch object returned, I can see the following field:

instantsearch.helper.lastResults.nbHits

which is, unsuprisingly, returning the previous result’s hit count.

Is there a way to get the current hit count?

Thanks in advance.

Hi,
InstantSearch.js comes with a Stats widget that displays, among other things, the number of hits:

If you want to customize the display to just have the number of hits, then you’re looking for the related connector:

Hope that helps :slight_smile:

1 Like

Hi @nicolas.torres,

That’s perfect, thanks again!