1Lucy::Index::IndexManagUesre(r3)Contributed Perl DocumenLtuactyi:o:nIndex::IndexManager(3)
2
3
4
6 Lucy::Index::IndexManager - Policies governing index updating, locking,
7 and file deletion.
8
10 use Sys::Hostname qw( hostname );
11 my $hostname = hostname() or die "Can't get unique hostname";
12 my $manager = Lucy::Index::IndexManager->new(
13 host => $hostname,
14 );
15
16 # Index time:
17 my $indexer = Lucy::Index::Indexer->new(
18 index => '/path/to/index',
19 manager => $manager,
20 );
21
22 # Search time:
23 my $reader = Lucy::Index::IndexReader->open(
24 index => '/path/to/index',
25 manager => $manager,
26 );
27 my $searcher = Lucy::Search::IndexSearcher->new( index => $reader );
28
30 IndexManager is an advanced-use class for controlling index locking,
31 updating, merging, and deletion behaviors.
32
33 IndexManager and Architecture are complementary classes: Architecture
34 is used to define traits and behaviors which cannot change for the life
35 of an index; IndexManager is used for defining rules which may change
36 from process to process.
37
39 new
40 my $manager = Lucy::Index::IndexManager->new(
41 host => $hostname, # default: ""
42 );
43
44 Create a new IndexManager.
45
46 · host - An identifier which should be unique per-machine.
47
48 · lock_factory - A LockFactory.
49
51 set_folder
52 $index_manager->set_folder($folder);
53 $index_manager->set_folder(); # default: undef
54
55 Setter for "folder" member. Typical clients (Indexer, IndexReader)
56 will use this method to install their own Folder instance.
57
58 get_folder
59 my $folder = $index_manager->get_folder();
60
61 Getter for "folder" member.
62
63 get_host
64 my $string = $index_manager->get_host();
65
66 Getter for "host" member.
67
68 recycle
69 my $arrayref = $index_manager->recycle(
70 reader => $reader, # required
71 del_writer => $del_writer, # required
72 cutoff => $cutoff, # required
73 optimize => $optimize, # default: false
74 );
75
76 Return an array of SegReaders representing segments that should be
77 consolidated. Implementations must balance index-time churn against
78 search-time degradation due to segment proliferation. The default
79 implementation prefers small segments or segments with a high
80 proportion of deletions.
81
82 · reader - A PolyReader.
83
84 · del_writer - A DeletionsWriter.
85
86 · cutoff - A segment number which all returned SegReaders must
87 exceed.
88
89 · optimize - A boolean indicating whether to spend extra time
90 optimizing the index for search-time performance.
91
92 make_write_lock
93 my $lock = $index_manager->make_write_lock();
94
95 Create the Lock which controls access to modifying the logical content
96 of the index.
97
98 set_write_lock_timeout
99 $index_manager->set_write_lock_timeout($timeout);
100
101 Setter for write lock timeout. Default: 1000 milliseconds.
102
103 get_write_lock_timeout
104 my $int = $index_manager->get_write_lock_timeout();
105
106 Getter for write lock timeout.
107
108 set_write_lock_interval
109 $index_manager->set_write_lock_interval($timeout);
110
111 Setter for write lock retry interval. Default: 100 milliseconds.
112
113 get_write_lock_interval
114 my $int = $index_manager->get_write_lock_interval();
115
116 Getter for write lock retry interval.
117
119 Lucy::Index::IndexManager isa Clownfish::Obj.
120
121
122
123perl v5.32.0 2020-07-28 Lucy::Index::IndexManager(3)