Catman...chable(3pm)

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

πŸ’– Catmandu::Searchable πŸ’–

okay bestie, gather round β€” this is the manual page for Catmandu::Searchable(3pm), and it's straight outta the User Contributed Perl Documentation. here's the tea: Catmandu::Searchable is literally the optional role for searchable stores. that's it. that's the whole name. if your store wants to be searchable, this is the role she puts on. periodt. πŸŽ€


✨ SYNOPSIS ✨

look at her go, fr fr:

my $store = Catmandu::Store::Solr->new();

# Return one page of search results (page size = 1000)
my $hits  = $store->bag->search(
       query => 'dna' ,
       start => 0 ,
       limit => 100 ,
       sort  => 'title desc',
            );

# Return all the search results as iterator
my $it    = $store->bag->searcher(query => 'dna');
$it->each(sub { ...});

$store->bag->delete_by_query(query => 'dna');

searching, iterating, deleting-by-query β€” main character energy, honestly. πŸ‘‘


🧚 CONFIGURATION 🧚

default_limit

the default value for limit. by default this is 10. so if you don't say anything, she just assumes 10. lowkey sensible. πŸ’…

maximum_limit

the maximum allowed value for limit. by default this is 1000. go past that and… nope, not today. πŸ™ˆ

maximum_offset

the maximum allowed offset. when this is set, no hits will be returned after the hit offset is greater than maximum_offset β€” and that's specifically to avoid deep paging problems. pagination values will also be adjusted accordingly. it's giving "protect the server", and honestly? valid. πŸ”₯


πŸ’œ METHODS πŸ’œ

search(query => $query, start => $start, page => $page, limit => $num, sort => $sort)

search the database and returns a Catmandu::Hits on success. that Hits represents one result page of at most $num results. the $query and $sort should implement the query and sort syntax of the underlying search engine. iykyk. 🌈

optionally you can provide the index of the first result using the start option, or the starting page using the page option. the number of records in a result page can be set using the limit option. sorting options are being sent verbatim to the underlying search engine. verbatim!! no editing, no notes, she does not paraphrase. ✨

searcher(query => $query, start => $start, limit => $num, sort => $sort, cql_query => $cql)

search the database and return a Catmandu::Iterable on success. this iterator can be used to loop over the complete result set. the $query and $sort should implement the query and sort syntax of the underlying search engine. πŸ¦‹

optionally provide the index of the first result using the start option. the number of records in a page can be set using the limit option. sorting options are being sent verbatim to the underlying search engine. again. verbatim. πŸ’…

delete_by_query(query => $query)

delete items from the database that match $query. bye bestie. πŸ‘‹πŸ’€


🌸 CQL support 🌸

stores that support the CQL query language (https://www.loc.gov/standards/sru/cql/) also accept the cql_query and sru_sortkeys arguments. see Catmandu::CQLSearchable for more information. CQL girlies, this one's for you. 🫢


⭐ SEE ALSO ⭐

  • Catmandu::CQLSearchable
  • Catmandu::Hits
  • Catmandu::Paged

aaaand that's the whole page!! πŸŽ€ written up in perl v5.40.1, dated 2026-01-24 β€” mwah. iconic. no notes. πŸ’–βœ¨

πŸ“¦ where this page comes from