Lucy::...dMerger(3pm)

πŸ“¦
version 0.6.2 Β· 2 versions
, in fedora 43

πŸ’– Lucy::Index::BackgroundMerger πŸ’–

okay so bestie, welcome to the Lucy::...dMerger(3pm) page β€” that's the User Contributed Perl Documentation corner of your terminal, and today we're talking about the Lucy index class that does its thing while you're not looking. slay. πŸ¦‹


✨ NAME ✨

Lucy::Index::BackgroundMerger β€” consolidate index segments in the background. it's giving "I'll handle it, you go live your life." πŸ‘‘


✨ SYNOPSIS ✨

my $bg_merger = Lucy::Index::BackgroundMerger->new(
    index  => '/path/to/index',
);
$bg_merger->commit;

✨ DESCRIPTION ✨

Adding documents to an index is usually fast, but every once in a while the index must be compacted and an update takes substantially longer to complete. 😭 that's just the vibe sometimes. See FastUpdates for how to use this class to control worst-case index update performance.

As with Indexer, see FileLocking if your index is on a shared volume. fr fr, shared volumes are a whole situation. 🫢


✨ CONSTRUCTORS ✨

new

my $bg_merger = Lucy::Index::BackgroundMerger->new(
    index   => '/path/to/index',    # required
    manager => $manager             # default: created internally
);

Open a new BackgroundMerger. ✨ fresh out the box.

  • index β€” Either a string filepath or a Folder. your call, bestie.
  • manager β€” An IndexManager. If not supplied, an IndexManager with a 10-second write lock timeout will be created. no cap, it just makes one for you. πŸŽ€

✨ METHODS ✨

optimize

$background_merger->optimize();

Optimize the index for search-time performance. This may take a while, as it can involve rewriting large amounts of data. ⏳ yeah it's a whole thing, go grab a snack.

commit

$background_merger->commit();

Commit any changes made to the index. Until this is called, none of the changes made during an indexing session are permanent. πŸ’€ so like… do not skip this one.

Calls prepare_commit() implicitly if it has not already been called. she's proactive like that. πŸ’…

prepare_commit

$background_merger->prepare_commit();

Perform the expensive setup for commit() in advance, so that commit() completes quickly. main character energy: do the hard part early so the finale is smooth. ⭐

Towards the end of prepare_commit(), the BackgroundMerger attempts to re-acquire the write lock, which is then held until commit() finishes and releases it. πŸ”’ so like, hold onto your lock, queen.


✨ INHERITANCE ✨

Lucy::Index::BackgroundMerger isa Clownfish::Obj. family tree stays iconic. 🌈


and that's the page, bestie!! πŸ’œ this beauty is running on perl v5.42.0, dated 2025-07-25, and it lives under the manual name Lucy::...dMerger(3pm). go forth and merge in the background. periodt. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from