1Lucy::Search::PolySearcUhseerr(3C)ontributed Perl DocumeLnutcayt:i:oSnearch::PolySearcher(3)
2
3
4
6 Lucy::Search::PolySearcher - Aggregate results from multiple Searchers.
7
9 my $schema = MySchema->new;
10 for my $index (@index_paths) {
11 push @searchers, Lucy::Search::IndexSearcher->new( index => $index );
12 }
13 my $poly_searcher = Lucy::Search::PolySearcher->new(
14 schema => $schema,
15 searchers => \@searchers,
16 );
17 my $hits = $poly_searcher->hits( query => $query );
18
20 The primary use for PolySearcher is to aggregate results from several
21 indexes on a single machine.
22
24 new
25 my $poly_searcher = Lucy::Search::PolySearcher->new(
26 schema => $schema,
27 searchers => \@searchers,
28 );
29
30 Create a new PolySearcher.
31
32 · schema - A Schema.
33
34 · searchers - An array of Searchers.
35
37 doc_max
38 my $int = $poly_searcher->doc_max();
39
40 Return the maximum number of docs in the collection represented by the
41 Searcher, which is also the highest possible internal doc id.
42 Documents which have been marked as deleted but not yet purged are
43 included in this count.
44
45 doc_freq
46 my $int = $poly_searcher->doc_freq(
47 field => $field, # required
48 term => $term, # required
49 );
50
51 Return the number of documents which contain the term in the given
52 field.
53
54 · field - Field name.
55
56 · term - The term to look up.
57
58 collect
59 $poly_searcher->collect(
60 query => $query, # required
61 collector => $collector, # required
62 );
63
64 Iterate over hits, feeding them into a Collector.
65
66 · query - A Query.
67
68 · collector - A Collector.
69
70 fetch_doc
71 my $hit_doc = $poly_searcher->fetch_doc($doc_id);
72
73 Retrieve a document. Throws an error if the doc id is out of range.
74
75 · doc_id - A document id.
76
78 Lucy::Search::PolySearcher isa Lucy::Search::Searcher isa
79 Clownfish::Obj.
80
81
82
83perl v5.32.0 2020-07-28 Lucy::Search::PolySearcher(3)