Lucy::...archer(3pm)

๐Ÿ“ฆ
version 0.6.2 ยท 2 versions
, in fedora 43

๐Ÿ’– 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 โ€” A Schema. (yes bestie, the whole schema, not just a vibe)
  • searchers โ€” An array of Searchers. 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 โ€” A Query.
  • collector โ€” A Collector.

โญ 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