1Lucy::Index::IndexReadeUrs(e3r)Contributed Perl DocumentLautciyo:n:Index::IndexReader(3)
2
3
4

NAME

6       Lucy::Index::IndexReader - Read from an inverted index.
7

SYNOPSIS

9           my $reader = Lucy::Index::IndexReader->open(
10               index => '/path/to/index',
11           );
12           my $seg_readers = $reader->seg_readers;
13           for my $seg_reader (@$seg_readers) {
14               my $seg_name = $seg_reader->get_segment->get_name;
15               my $num_docs = $seg_reader->doc_max;
16               print "Segment $seg_name ($num_docs documents):\n";
17               my $doc_reader = $seg_reader->obtain("Lucy::Index::DocReader");
18               for my $doc_id ( 1 .. $num_docs ) {
19                   my $doc = $doc_reader->fetch_doc($doc_id);
20                   print "  $doc_id: $doc->{title}\n";
21               }
22           }
23

DESCRIPTION

25       IndexReader is the interface through which IndexSearcher objects access
26       the content of an index.
27
28       IndexReader objects always represent a point-in-time view of an index
29       as it existed at the moment the reader was created.  If you want search
30       results to reflect modifications to an index, you must create a new
31       IndexReader after the update process completes.
32
33       IndexReaders are composites; most of the work is done by individual
34       DataReader sub-components, which may be accessed via fetch() and
35       obtain().  The most efficient and powerful access to index data happens
36       at the segment level via SegReaderXs sub-components.
37

CONSTRUCTORS

39   open
40           my $reader = Lucy::Index::IndexReader->open(
41               index    => '/path/to/index', # required
42               snapshot => $snapshot,
43               manager  => $index_manager,
44           );
45
46       IndexReader is an abstract base class; open() returns the IndexReader
47       subclass PolyReader, which channels the output of 0 or more SegReaders.
48
49       ·   index - Either a string filepath or a Folder.
50
51       ·   snapshot - A Snapshot.  If not supplied, the most recent snapshot
52           file will be used.
53
54       ·   manager - An IndexManager.  Read-locking is off by default;
55           supplying this argument turns it on.
56

ABSTRACT METHODS

58   doc_max
59           my $int = $index_reader->doc_max();
60
61       Return the maximum number of documents available to the reader, which
62       is also the highest possible internal document id.  Documents which
63       have been marked as deleted but not yet purged from the index are
64       included in this count.
65
66   doc_count
67           my $int = $index_reader->doc_count();
68
69       Return the number of documents available to the reader, subtracting any
70       that are marked as deleted.
71
72   del_count
73           my $int = $index_reader->del_count();
74
75       Return the number of documents which have been marked as deleted but
76       not yet purged from the index.
77
78   offsets
79           my $i32_array = $index_reader->offsets();
80
81       Return an array with one entry for each segment, corresponding to
82       segment doc_id start offset.
83
84   seg_readers
85           my $arrayref = $index_reader->seg_readers();
86
87       Return an array of all the SegReaders represented within the
88       IndexReader.
89

METHODS

91   obtain
92           my $data_reader = $index_reader->obtain($api);
93
94       Fetch a component, or throw an error if the component canXt be found.
95
96       ·   api - The name of the DataReader subclass that the desired
97           component must implement.
98
99   fetch
100           my $data_reader = $index_reader->fetch($api);
101
102       Fetch a component, or return undef if the component canXt be found.
103
104       ·   api - The name of the DataReader subclass that the desired
105           component must implement.
106

INHERITANCE

108       Lucy::Index::IndexReader isa Lucy::Index::DataReader isa
109       Clownfish::Obj.
110
111
112
113perl v5.28.1                      2019-02-02       Lucy::Index::IndexReader(3)
Impressum