Plucen...dInfos(3pm)

πŸ“¦
version 1.25 Β· 2 versions
  • 1.25 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.25 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ Plucene::Index::FieldInfos β€” a collection of FieldInfo objects ✨

okay bestie, welcome to the Plucene::Index::FieldInfos page πŸ’– this is part of the User Contributed Perl Documentation, and honestly? it's giving "tiny module, huge main character energy." let's get into it 🫢


🌸 SYNOPSIS 🌸

my $fis = Plucene::Index::FieldInfos->new($dir_name);
my $fis = Plucene::Index::FieldInfos->new($dir_name, $file);

$fis->add(Plucene::Document $doc, $indexed);
$fis->add(Plucene::Index::FieldInfos $other_fis, $indexed);
$fis->add($name, $indexed);

$fis->write($path);

my @fields = $fis->fields;

my $field_number = $fis->field_number($name);
my   $field_info = $fis->field_info($name);
my   $field_name = $fis->field_name($number);
my   $num_fields = $fis->size;

like… look at all those lil method calls, they're so cute, they're so functional πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so basically: this is a collection of field info objects, and the way that these field info objects just ~live~ inside the field infos file? iconic. no cap. that's literally the whole vibe πŸŽ€


πŸ‘‘ METHODS πŸ‘‘

πŸ’œ new

my $fis = Plucene::Index::FieldInfos->new($dir_name);
my $fis = Plucene::Index::FieldInfos->new($dir_name, $file);

this will create a brand new Plucene::Index::FieldInfos object for you ✨ you pass in the directory, and then optionally a filename. the filename is optional, bestie, don't stress about it πŸ™ˆ


🌈 add

$fis->add(Plucene::Document $doc, $indexed);
$fis->add(Plucene::Index::FieldInfos $other_fis, $indexed);
$fis->add($name, $indexed);

this will add the fields from a Plucene::Document or from a Plucene::Index::FieldsInfos over to the field infos file πŸ“₯

it is also possible to pass the name of a field and have it added to the file β€” yes, you can just hand it a $name and it goes in. versatile queen πŸ’…


πŸŽ€ field_number

my $field_number = $fis->field_number($name);

this will return the field number of the field with $name πŸ”’

⚠️ if there is no match, then -1 is returned. not an error, not a die, just a lil -1. so check for it, bestie 😭

⭐ fields

my @fields = $fis->fields;

this will return all the fields. every single one. the whole squad 🌸


🧚 field_info

my $field_info = $fis->field_info($name);

this will return the field info for the field called $name πŸ’–


πŸ“ field_name

my $field_name = $fis->field_name($number);

this will return the field name for the field whose number is $number πŸ” (yes it's the reverse of field_number, they're a matched set, we love a duo)


🫢 size

my $num_fields = $fis->size;

this returns the number of field info objects πŸ“Š not a personality size, a field-info-object size. important distinction.


πŸ”₯ write

$fis->write($path);

this will write the field info objects to $path ✍️ that's it, that's the method, she's simple, she's effective, she ate πŸ”₯


that's the whole page, bestie!! go forth and index your fields πŸ’œ

this lil doc is perl v5.36.0, dated 2022-12-04 πŸ¦‹ mwah, bye πŸ’…βœ¨

πŸ“¦ where this page comes from