1Lucy::Index::PolyReaderU(s3eprm)Contributed Perl DocumenLtuactyi:o:nIndex::PolyReader(3pm)
2
3
4
6 Lucy::Index::PolyReader - Multi-segment implementation of IndexReader.
7
9 my $polyreader = Lucy::Index::IndexReader->open(
10 index => '/path/to/index',
11 );
12 my $doc_reader = $polyreader->obtain("Lucy::Index::DocReader");
13 for my $doc_id ( 1 .. $polyreader->doc_max ) {
14 my $doc = $doc_reader->fetch_doc($doc_id);
15 print " $doc_id: $doc->{title}\n";
16 }
17
19 PolyReader conflates index data from multiple segments. For instance,
20 if an index contains three segments with 10 documents each,
21 PolyReader’s doc_max() method will return 30.
22
23 Some of PolyReader’s DataReader components may be less efficient or
24 complete than the single-segment implementations accessed via
25 SegReader.
26
28 doc_max
29 my $int = $poly_reader->doc_max();
30
31 Return the maximum number of documents available to the reader, which
32 is also the highest possible internal document id. Documents which
33 have been marked as deleted but not yet purged from the index are
34 included in this count.
35
36 doc_count
37 my $int = $poly_reader->doc_count();
38
39 Return the number of documents available to the reader, subtracting any
40 that are marked as deleted.
41
42 del_count
43 my $int = $poly_reader->del_count();
44
45 Return the number of documents which have been marked as deleted but
46 not yet purged from the index.
47
48 offsets
49 my $i32_array = $poly_reader->offsets();
50
51 Return an array with one entry for each segment, corresponding to
52 segment doc_id start offset.
53
54 seg_readers
55 my $arrayref = $poly_reader->seg_readers();
56
57 Return an array of all the SegReaders represented within the
58 IndexReader.
59
61 Lucy::Index::PolyReader isa Lucy::Index::IndexReader isa
62 Lucy::Index::DataReader isa Clownfish::Obj.
63
64
65
66perl v5.38.0 2023-07-20 Lucy::Index::PolyReader(3pm)