Lucy::...Reader(3pm)

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

✨ Lucy::Index::LexiconReader ✨

okay bestie, so this page lives in the Lucy::...Reader(3pm) manual (it's User Contributed Perl Documentation, very demure, very cpan), and the actual NAME of the thing we're stanning is Lucy::Index::LexiconReader β€” it reads Lexicon data. that's the whole vibe. πŸ¦‹


πŸ“– NAME

Lucy::Index::LexiconReader β€” Read Lexicon data. that's it, that's the name, no notes. πŸ’…


πŸŽ€ SYNOPSIS

here's how you slide into its DMs:

my $lex_reader = $seg_reader->obtain("Lucy::Index::LexiconReader");
my $lexicon    = $lex_reader->lexicon( field => 'title' );

see? not scary. you obtain the reader, then you ask it for a lexicon. periodt. ✨


🌸 DESCRIPTION

so what does this thing do, you ask? LexiconReader reads term dictionary information. that's the whole job description, and honestly? it ate. πŸ‘‘


πŸ”₯ ABSTRACT METHODS

these are abstract, which is the polite way of saying "girl you gotta implement these yourself, the base class isn't doing it for you". no cap. 😭

πŸ“š lexicon

my $lexicon = $lexicon_reader->lexicon(
    field => $field,  # required
    term  => $term,   # default: undef
);

Return a new Lexicon for the given "field". Will return undef if either the field is not indexed, or if no documents contain a value for the field. so like… undef is the "she's not here right now" of return values. πŸ™ˆ

  • field β€” Field name. required, bestie, don't skip it.
  • term β€” Pre-locate the Lexicon to this term.

πŸ”’ doc_freq

my $int = $lexicon_reader->doc_freq(
    field => $field,  # required
    term  => $term,   # required
);

Return the number of documents where the specified term is present. just a lil integer doing its thing. lowkey iconic. πŸ“


πŸ’– METHODS

🧚 aggregator

my $result = $lexicon_reader->aggregator(
    readers => $readers,  # required
    offsets => $offsets,  # required
);

Return a LexiconReader which merges the output of other LexiconReaders. it's giving group project, but make it functional. 🌈

  • readers β€” An array of LexiconReaders.
  • offsets β€” Doc id start offsets for each reader.

πŸ‘‘ INHERITANCE

the family tree, if you will:

Lucy::Index::LexiconReader isa Lucy::Index::DataReader isa Clownfish::Obj.

generational excellence, truly. 🫢


πŸ’€ heads up: lexicon and doc_freq are abstract β€” this base class is not out here doing the work for you. don't come for it when you get undef or an unfulfilled promise, okay? and doc_freq needs both field and term, no skimping.

and that's the whole page, bestie!! this was pulled from Lucy::...Reader(3pm) in the User Contributed Perl Documentation, and the footer energy was perl v5.42.0 dated 2025-07-25. mwah. go read some lexicons. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from