1Lucy::Plan::ArchitecturUes(e3r)Contributed Perl DocumentLautciyo:n:Plan::Architecture(3)
2
3
4
6 Lucy::Plan::Architecture - Configure major components of an index.
7
9 package MyArchitecture;
10 use base qw( Lucy::Plan::Architecture );
11
12 use LucyX::Index::ZlibDocWriter;
13 use LucyX::Index::ZlibDocReader;
14
15 sub register_doc_writer {
16 my ( $self, $seg_writer ) = @_;
17 my $doc_writer = LucyX::Index::ZlibDocWriter->new(
18 snapshot => $seg_writer->get_snapshot,
19 segment => $seg_writer->get_segment,
20 polyreader => $seg_writer->get_polyreader,
21 );
22 $seg_writer->register(
23 api => "Lucy::Index::DocReader",
24 component => $doc_writer,
25 );
26 $seg_writer->add_writer($doc_writer);
27 }
28
29 sub register_doc_reader {
30 my ( $self, $seg_reader ) = @_;
31 my $doc_reader = LucyX::Index::ZlibDocReader->new(
32 schema => $seg_reader->get_schema,
33 folder => $seg_reader->get_folder,
34 segments => $seg_reader->get_segments,
35 seg_tick => $seg_reader->get_seg_tick,
36 snapshot => $seg_reader->get_snapshot,
37 );
38 $seg_reader->register(
39 api => 'Lucy::Index::DocReader',
40 component => $doc_reader,
41 );
42 }
43
44 package MySchema;
45 use base qw( Lucy::Plan::Schema );
46
47 sub architecture {
48 shift;
49 return MyArchitecture->new(@_);
50 }
51
53 By default, a Lucy index consists of several main parts: lexicon,
54 postings, stored documents, deletions, and highlight data. The readers
55 and writers for that data are spawned by Architecture. Each component
56 operates at the segment level; ArchitectureXs factory methods are used
57 to build up SegWriter and SegReader.
58
60 new
61 my $arch = Lucy::Plan::Architecture->new;
62
63 Constructor. Takes no arguments.
64
66 register_doc_writer
67 $architecture->register_doc_writer($writer);
68
69 Spawn a DataWriter and register() it with the supplied SegWriter,
70 adding it to the SegWriterXs writer stack.
71
72 · writer - A SegWriter.
73
74 register_doc_reader
75 $architecture->register_doc_reader($reader);
76
77 Spawn a DocReader and register it with the supplied SegReader.
78
79 · reader - A SegReader.
80
82 Lucy::Plan::Architecture isa Clownfish::Obj.
83
84
85
86perl v5.30.0 2019-07-26 Lucy::Plan::Architecture(3)