Skip to main content
Signature

Explore example code

Browse the Stats example code on GitHub.

About this widget

Each search Response contains various metadata that you might display in your search experience. The following information is available as a part of the Response:
  • hitsPerPage. Number of hits per page.
  • totalHitsCount. Total number of hits.
  • pagesCount. Total number of pages.
  • page. Current page.
  • processingTimeMS. Processing time of the search request (in ms).
  • serverTimeMS. Processing time of the complete request (in ms).
  • query. Query text that produced these results.
See also: Get started with imperative UI

Examples

Kotlin

Low-level API

If you want to fully control the Stats components and connect them manually, use the following components:
  • Searcher. The Searcher that handles your searches.
  • StatsViewModel. The logic applied to the stats.
  • StatsView. The view that renders the stats.
Kotlin

Compose UI

InstantSearch provides the StatsState as a state model, which is an implementation of the StatsView interface. You need to connect StatsState to the StatsConnector or StatsViewModel like any other StatsView implementation.
Kotlin

Parameters

searcher
HitsSearcher
required
The Searcher that handles your searches.
searchResponse
SearchResponse
The initial search response to render.

View

view
required
The view that renders the stats.
presenter
StatsPresenter<T>
required
The presenter that defines the way we want to display stats, taking as input a Response and returning a T.
Kotlin
Last modified on July 22, 2026