---
name: "Catmandu::Hits"
section: "3pm"
platform: "linux"
package: "libcatmandu-perl"
version: "1.2024-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Catmandu::Hits"
---

# Catmandu::Hits(3pm)

Iterable object that wraps Catmandu::Store search hits

## NAME

Catmandu::Hits - Iterable object that wraps Catmandu::Store search hits

## SYNOPSIS

```
    my $store = Catmandu::Store::Solr->new;
    my $hits  = $store->bag->search(
           query => 'dna' ,
           start => 0 ,
           limit => 100 ,
           sort  => 'title desc',
                );
    # Every hits is an iterator...
    $hits->each(sub { ... });
    printf "Found %s $hits\n" , $hits->total;
    my $start = $hits->start;
    my $limit = $hits->limit;
    my $prev = $hits->previous_page;
    my $next = $hits->next_page;
```

## METHODS

A Catmandu::Hits object provides the following methods in addition to methods of Catmandu::Iterable and Catmandu::Paged.

### total

Returns the total number of hits matching the query.

### start

Returns the start index for the search results.

### limit

Returns the maximum number of search results returned.

### more

Return true if there are more search results.

## SEE ALSO

Catmandu::Bag, Catmandu::Searchable, Catmandu::Store
