> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stats

> Shows data about the performed search.

export const SearchRequest = () => <Tooltip tip="A search request is a single HTTP call to the Algolia Search API that can run one or more search operations. It can include multiple queries, for example, when querying several indices at once.">
    search request
  </Tooltip>;

export const SearchQuery = () => <Tooltip tip="The text users enter into a search box. In the Search API, this corresponds to the query parameter. A search query is often used with filters, facets, and other parameters, but these aren't part of the query text itself.">
    search query
  </Tooltip>;

## About this widget

Each search `Response` contains various metadata you might display in your search experience.

The following information is available as a part of the `Response`:

* `hitsPerPage`. Number of hits per page.
* `nbHits`. Total number of hits.
* `nbPages`. Total number of pages.
* `page`. Current page.
* `processingTimeMS`. Processing time of the <SearchRequest /> (in ms).
* `query`. <SearchQuery /> that produced these results.

## Examples

```dart Dart icon=code theme={"system"}
class SearchStats extends StatelessWidget {
  const SearchStats(this.responses, {super.key});

  final Stream<SearchResponse> responses;

  @override
  Widget build(BuildContext context) {
    return StreamBuilder<SearchResponse>(
        stream: responses,
        builder: (context, snapshot) => Text(stats(snapshot.data)));
  }

  String stats(SearchResponse? response) {
    if (response == null) return '';
    final buffer = StringBuffer();
    if (!response.exhaustiveNbHits) buffer.write("~");
    buffer.write("${response.nbHits} hits ");
    buffer.write("in ${response.processingTimeMS} ms");
    return buffer.toString();
  }
}
```
