Catmandu::Hits(3pm)

πŸ“¦
version 1.2025 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– Catmandu::Hits β€” bestie edition πŸ’–

okay so this is Catmandu::Hits, a page straight out of the User Contributed Perl Documentation (perl v5.40.1, dated 2026-01-24, if you're keeping receipts). It's an iterable object that wraps up your Catmandu::Store search hits, like a little gift bag for your query results. πŸŽ€


✨ NAME ✨

Catmandu::Hits β€” an iterable object that wraps Catmandu::Store search hits. That's the whole vibe. It's giving "I hold your search results and I'm cute about it." πŸ’…


🌸 SYNOPSIS 🌸

Here's the whole flow, bestie, no cap:

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;

lowkey iconic, right? You make a store, you search a bag, you get hits. Then β€” and this is the part that matters β€” every hits is an iterator, so you can each your way through them like it's nothing. πŸ’«

Then you can peek at total, start, and limit, and grab your previous_page and next_page like the main character you are. πŸ‘‘


πŸ¦‹ METHODS πŸ¦‹

A Catmandu::Hits object provides the following methods in addition to methods of Catmandu::Iterable and Catmandu::Paged. So like, it's already stacked, and then it has these extra ones on top. Obsessed. ✨

πŸ“ total

Returns the total number of hits matching the query. That's it, that's the tea. β˜•

πŸŽ€ 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. So if you're wondering "is there more?" β€” this is your girl. 🫢


⭐ SEE ALSO ⭐

Go read these next, bestie, they're the whole friend group:

  • Catmandu::Bag
  • Catmandu::Searchable
  • Catmandu::Store

and that's the page!! πŸŒΈπŸ¦‹πŸ’– Signing off with the credits, because you know I have to: this one's from perl v5.40.1, dated 2026-01-24, and it lives at Catmandu::Hits(3pm). slay, go search something. πŸ’…βœ¨

πŸ“¦ where this page comes from