1Lucy::Index::BackgroundUMseerrgeCro(n3t)ributed Perl DocLuumceyn:t:aItnidoenx::BackgroundMerger(3)
2
3
4
6 Lucy::Index::BackgroundMerger - Consolidate index segments in the
7 background.
8
10 my $bg_merger = Lucy::Index::BackgroundMerger->new(
11 index => '/path/to/index',
12 );
13 $bg_merger->commit;
14
16 Adding documents to an index is usually fast, but every once in a while
17 the index must be compacted and an update takes substantially longer to
18 complete. See FastUpdates for how to use this class to control worst-
19 case index update performance.
20
21 As with Indexer, see FileLocking if your index is on a shared volume.
22
24 new
25 my $bg_merger = Lucy::Index::BackgroundMerger->new(
26 index => '/path/to/index', # required
27 manager => $manager # default: created internally
28 );
29
30 Open a new BackgroundMerger.
31
32 • index - Either a string filepath or a Folder.
33
34 • manager - An IndexManager. If not supplied, an IndexManager with a
35 10-second write lock timeout will be created.
36
38 optimize
39 $background_merger->optimize();
40
41 Optimize the index for search-time performance. This may take a while,
42 as it can involve rewriting large amounts of data.
43
44 commit
45 $background_merger->commit();
46
47 Commit any changes made to the index. Until this is called, none of
48 the changes made during an indexing session are permanent.
49
50 Calls prepare_commit() implicitly if it has not already been called.
51
52 prepare_commit
53 $background_merger->prepare_commit();
54
55 Perform the expensive setup for commit() in advance, so that commit()
56 completes quickly.
57
58 Towards the end of prepare_commit(), the BackgroundMerger attempts to
59 re-acquire the write lock, which is then held until commit() finishes
60 and releases it.
61
63 Lucy::Index::BackgroundMerger isa Clownfish::Obj.
64
65
66
67perl v5.36.0 2023-01-20 Lucy::Index::BackgroundMerger(3)