1Lucy::Index::SegWriter(U3spemr)Contributed Perl DocumentLautciyo:n:Index::SegWriter(3pm)
2
3
4
6 Lucy::Index::SegWriter - Write one segment of an index.
7
9 SegWriter is a conduit through which information fed to Indexer passes.
10 It manages Segment and Inverter, invokes the Analyzer chain, and feeds
11 low level DataWriters such as PostingListWriter and DocWriter.
12
13 The sub-components of a SegWriter are determined by Architecture.
14 DataWriter components which are added to the stack of writers via
15 add_writer() have Add_Inverted_Doc() invoked for each document supplied
16 to SegWriter’s add_doc().
17
19 register
20 $seg_writer->register(
21 api => $api, # required
22 component => $component, # required
23 );
24
25 Register a DataWriter component with the SegWriter. (Note that
26 registration simply makes the writer available via fetch(), so you may
27 also want to call add_writer()).
28
29 • api - The name of the DataWriter api which "writer" implements.
30
31 • component - A DataWriter.
32
33 fetch
34 my $obj = $seg_writer->fetch($api);
35
36 Retrieve a registered component.
37
38 • api - The name of the DataWriter api which the component
39 implements.
40
41 add_writer
42 $seg_writer->add_writer($writer);
43
44 Add a DataWriter to the SegWriter’s stack of writers.
45
46 add_doc
47 $seg_writer->add_doc(
48 doc => $doc, # required
49 boost => $boost, # default: 1.0
50 );
51
52 Add a document to the segment. Inverts "doc", increments the Segment’s
53 internal document id, then calls Add_Inverted_Doc(), feeding all sub-
54 writers.
55
56 add_segment
57 $seg_writer->add_segment(
58 reader => $reader, # required
59 doc_map => $doc_map, # default: undef
60 );
61
62 Add content from an existing segment into the one currently being
63 written.
64
65 • reader - The SegReader containing content to add.
66
67 • doc_map - An array of integers mapping old document ids to new.
68 Deleted documents are mapped to 0, indicating that they should be
69 skipped.
70
71 finish
72 $seg_writer->finish();
73
74 Complete the segment: close all streams, store metadata, etc.
75
77 Lucy::Index::SegWriter isa Lucy::Index::DataWriter isa Clownfish::Obj.
78
79
80
81perl v5.38.0 2023-07-20 Lucy::Index::SegWriter(3pm)