Plucen...tReader(3pm)
β¨ Plucene::Index::SegmentReader β the Segment reader π
okay bestie so this is Plucene::Index::SegmentReader, a 3pm perl module, and it is literally the reader for a segment. yes, the segment reader. main character of index segments, no cap. πΈ
π¦ NAME
Plucene::Index::SegmentReader β the Segment reader π
β¨ SYNOPSIS
my $seg_reader =
Plucene::Index::SegmentReader->new( Plucene::Index::SegmentInfo $si);
my @files = $seg_reader->files;
my @terms = $seg_reader->terms;
my $doc = $seg_reader->document($id);
my $doc_freq = $seg_reader->doc_freq($term);
my $max_doc = $seg_reader->max_doc;
my $norms = $seg_reader->norms($field, $offset);
my Plucene::Index::SegmentTermDocs $docs
= $seg_reader->term_docs($term);
my Plucene::Index::SegmentTermPositions $pos
= $seg_reader->term_positions($term);
my Plucene::Store::InputStream $stream
= $seg_reader->norm_stream($field);
if ($seg_reader->is_deleted($id)) { .. }
if ($seg_reader->has_deletions(Plucene::Index::SegmentInfo $si))
{ ... }
like, that's the whole vibe right there π copy it, paste it, slay.
π DESCRIPTION
The segment reader class. that's it, that's the description, and honestly? iconic. short, sweet, knows what it is. π
π METHODS
π new
my $seg_reader =
Plucene::Index::SegmentReader->new( Plucene::Index::SegmentInfo $si);
This will create a new Plucene::Index::SegmentReader object. brand new, fresh out the box, born this way π
π§ has_deletions
if ($seg_reader->has_deletions(Plucene::Index::SegmentInfo $si))
{ ... }
πΈ files
my @files = $seg_reader->files;
β terms
my @terms = $seg_reader->terms;
π¦ document
my $doc = $seg_reader->document($id);
π is_deleted
if ($seg_reader->is_deleted($id)) { .. }
π term_docs
my Plucene::Index::SegmentTermDocs $docs
= $seg_reader->term_docs($term);
This will return the Plucene::Index::SegmentTermDocs object for the given term. give it a term, get the docs object back. π«Ά
π₯ term_positions
my Plucene::Index::SegmentTermPositions $pos
= $seg_reader->term_positions($term);
This will return the Plucene::Index::SegmentTermPositions object for the given term. same energy as above but, you know, positions. β¨
π doc_freq
my $doc_freq = $seg_reader->doc_freq($term);
This returns the number of documents containing the passed term. how many docs said that word? this tells you. periodt. π
π num_docs
my $num_docs = $seg_reader->num_docs;
This is the number of documents, excluding deleted ones. the deleted ones don't count, they're in their flop era π
π max_doc
my $max_doc = $seg_reader->max_doc;
π§ norms
my $norms = $seg_reader->norms($field, $offset);
This returns the byte-encoded normalisation factor for the passed field. This is used by the search code to score documents. scoring, bestie, it's all about the scoring. π
Note we are not using the'offset'and'bytes'arguments per the Java. Instead, callers should usesubstrto put the result of"norms"into the appropriate place in a string.
like, real talk, this is a deviation from the Java version and you have to handle it yourself with substr. no cap, don't forget. π
π norm_stream
my Plucene::Store::InputStream $stream
= $seg_reader->norm_stream($field);
This will return the Plucene::Store::InputStream for the passed field. stream it, bestie. π
π«Ά SEE ALSO
(nothing else listed here, so this is a lil solo moment β go forth and read your segments)
and that's the whole page, bestie! this was Plucene::Index::SegmentReader, from the User Contributed Perl Documentation, perl v5.36.0, dated 2022-12-04. slay, stay indexed, mwah ππβ¨
π¦ where this page comes from
- debian bookworm: libplucene-perl 1.25-5
- debian trixie: libplucene-perl 1.25-5
- ubuntu noble: libplucene-perl 1.25-5
- ubuntu resolute: libplucene-perl 1.25-5
- ubuntu stonking: libplucene-perl 1.25-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms