Lucy::...Manager(3pm)

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

πŸ’– Lucy::Index::IndexManager β€” the manual, but make it make sense πŸ’–

okay bestie, so this is Lucy::Index::IndexManager, and it lives in the User Contributed Perl Documentation section (3pm, for the Perl girlies 🫢). It's the boss of index updating, locking, and file deletion. Let's get into it. ✨


🌸 NAME 🌸

Lucy::Index::IndexManager β€” the policies governing index updating, locking, and file deletion. she's the rule-maker, the vibe-setter, the one in charge. πŸ‘‘


✨ SYNOPSIS ✨

use Sys::Hostname qw( hostname );
my $hostname = hostname() or die "Can't get unique hostname";
my $manager = Lucy::Index::IndexManager->new(
    host => $hostname,
);

# Index time:
my $indexer = Lucy::Index::Indexer->new(
    index => '/path/to/index',
    manager => $manager,
);

# Search time:
my $reader = Lucy::Index::IndexReader->open(
    index   => '/path/to/index',
    manager => $manager,
);
my $searcher = Lucy::Search::IndexSearcher->new( index => $reader );

like, she rolls up to both index time and search time. versatile queen. πŸ’…


🌈 DESCRIPTION 🌈

IndexManager is an advanced-use class, meaning it's for when you're ready to level up β€” she controls index locking, updating, merging, and deletion behaviors. no cap.

so here's the tea β˜•: IndexManager and Architecture are complementary classes, they're besties who each handle a different lane:

  • Architecture β€” defines traits and behaviors which cannot change for the life of an index. she's locked in forever, periodt.
  • IndexManager β€” defines rules which may change from process to process. she's flexible, she's fluid, she's giving main character energy. πŸ¦‹

πŸŽ€ CONSTRUCTORS πŸŽ€

new

my $manager = Lucy::Index::IndexManager->new(
    host => $hostname,    # default: ""
);

Create a fresh new IndexManager. baby's first manager. πŸ’–

  • host β€” an identifier which should be unique per-machine. lowkey important, don't skip it.
  • lock_factory β€” a LockFactory. πŸ”’

πŸ’œ METHODS πŸ’œ

set_folder

$index_manager->set_folder($folder);
$index_manager->set_folder();  # default: undef

Setter for the "folder" member. Typical clients (Indexer, IndexReader) will use this method to install their own Folder instance. so they're the ones doing the installing, not you. noted. πŸ“

get_folder

my $folder = $index_manager->get_folder();

Getter for the "folder" member. the matching pair, as she should. πŸ’…

get_host

my $string = $index_manager->get_host();

Getter for the "host" member. she tells you where she's from. 🏠

recycle

my $arrayref = $index_manager->recycle(
    reader     => $reader,      # required
    del_writer => $del_writer,  # required
    cutoff     => $cutoff,      # required
    optimize   => $optimize,    # default: false
);

Returns an array of SegReaders representing segments that should be consolidated. 🧹

Implementations must balance index-time churn against search-time degradation due to segment proliferation β€” so like, don't let segments multiply like bunnies 🐰 or your searches will suffer. The default implementation prefers small segments, or segments with a high proportion of deletions. she's got taste.

  • reader β€” a PolyReader.
  • del_writer β€” a DeletionsWriter.
  • cutoff β€” a segment number which all returned SegReaders must exceed. (so, strictly bigger than cutoff, bestie)
  • optimize β€” a boolean indicating whether to spend extra time optimizing the index for search-time performance. trading time for speed, iconic behavior honestly ⏳➑️⚑

make_write_lock

my $lock = $index_manager->make_write_lock();

Create the Lock which controls access to modifying the logical content of the index. πŸ” one at a time, girlies, we're not fighting over the index.

set_write_lock_timeout

$index_manager->set_write_lock_timeout($timeout);

Setter for write lock timeout. Default: 1000 milliseconds. ⏰

get_write_lock_timeout

my $int = $index_manager->get_write_lock_timeout();

Getter for write lock timeout. she'll tell you how long she's willing to wait. 😌

set_write_lock_interval

$index_manager->set_write_lock_interval($timeout);

Setter for write lock retry interval. Default: 100 milliseconds. πŸ” that's how often she comes back to try again. persistent queen.

get_write_lock_interval

my $int = $index_manager->get_write_lock_interval();

Getter for write lock retry interval. πŸ’«


πŸ‘‘ INHERITANCE πŸ‘‘

Lucy::Index::IndexManager isa Clownfish::Obj. she comes from a long line of distinguished objects, and she honors her lineage. 🧬


quick reminder bestie: this is the whole manual, every flag and default included β€” nothing skipped, nothing invented. read it, love it, use it responsibly. πŸ’–

that's the whole page, fr fr 🌸 this doc came from the User Contributed Perl Documentation, built for perl v5.42.0 and dated 2025-07-25 β€” so if you're reading this from the future, hi, hope the index is thriving πŸ¦‹βœ¨ mwah, go slay your segments πŸ’…

πŸ“¦ where this page comes from