Lucy::...archer(3pm)
๐ Lucy::Search::PolySearcher ๐
okay so bestie, welcome to the manual page for Lucy::Search::PolySearcher, straight out of the User Contributed Perl Documentation. Sit down, grab a strawberry ๐, and let's get into it.
โจ NAME โจ
Lucy::Search::PolySearcher โ aggregate results from multiple Searchers. That's the whole vibe. Multiple searchers, one glow-up. ๐
๐ธ SYNOPSIS ๐ธ
my $schema = MySchema->new;
for my $index (@index_paths) {
push @searchers, Lucy::Search::IndexSearcher->new( index => $index );
}
my $poly_searcher = Lucy::Search::PolySearcher->new(
schema => $schema,
searchers => \@searchers,
);
my $hits = $poly_searcher->hits( query => $query );
no cap, that's literally the whole flow: build a schema, loop over your index paths pushing a Lucy::Search::IndexSearcher for each one, hand the whole squad to Lucy::Search::PolySearcher->new, and then call hits with your query. Done. Iconic. ๐
๐ฆ DESCRIPTION ๐ฆ
The primary use for PolySearcher is to aggregate results from several indexes on a single machine. That's it, that's the job โ it's the friend who collects everyone's location pins and puts them all on one map. ๐บ๏ธโจ
๐ CONSTRUCTORS ๐
๐ new
my $poly_searcher = Lucy::Search::PolySearcher->new(
schema => $schema,
searchers => \@searchers,
);
Create a new PolySearcher. main character energy only. โจ
schemaโ ASchema. (yes bestie, the whole schema, not just a vibe)searchersโ An array ofSearchers. Bring the whole group chat. ๐ซถ
๐ฅ METHODS ๐ฅ
๐ doc_max
my $int = $poly_searcher->doc_max();
Return the maximum number of docs in the collection represented by the Searcher โ which is also the highest possible internal doc id. And listen: documents which have been marked as deleted but not yet purged are still included in this count. ๐ They're ghosts but they still get counted, fr fr.
๐ doc_freq
my $int = $poly_searcher->doc_freq(
field => $field, # required
term => $term, # required
);
Return the number of documents which contain the term in the given field. Like a headcount, but for matching docs. ๐งฎ
fieldโ Field name. Required, no skipping.termโ The term to look up. Also required. Both of them. Don't play. ๐
๐ง collect
$poly_searcher->collect(
query => $query, # required
collector => $collector, # required
);
Iterate over hits, feeding them into a Collector. It's giving conveyor belt but make it search. ๐ฝ๏ธ
queryโ AQuery.collectorโ ACollector.
โญ fetch_doc
my $hit_doc = $poly_searcher->fetch_doc($doc_id);
Retrieve a document. Throws an error if the doc id is out of range. So like, stay in your lane, doc id. ๐ญ
doc_idโ A document id.
๐ INHERITANCE ๐
Lucy::Search::PolySearcher isa Lucy::Search::Searcher isa Clownfish::Obj.
the family tree ate, honestly. ๐ณโจ
๐ sign-off ๐
That's the whole page, bestie โ brought to you by perl v5.42.0, dated 2025-07-25, and delivered with love from the User Contributed Perl Documentation. go aggregate those indexes, you absolute legend. ๐โจ๐ฆ
๐ฆ where this page comes from
- fedora 43: perl-Lucy 0.6.2-26.fc43 ยท Apache-2.0 AND MIT AND Unicode-DFS-2015
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms