Lucy::...nt::Doc(3pm)

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

✨ NAME ✨

Lucy::Document::Doc β€” a whole entire document, bestie πŸ’– (like, the Lucy::...nt::Doc(3pm) one, yes that's her, that's the icon)


🌸 SYNOPSIS 🌸

my $doc = Lucy::Document::Doc->new(
    fields => { foo => 'foo foo', bar => 'bar bar' },
);
$indexer->add_doc($doc);

Doc objects let you get at field values via hashref overloading, which is genuinely so slay:

$doc->{foo} = 'new value for field "foo"';
print "foo: $doc->{foo}\n";

πŸ’… DESCRIPTION πŸ’…

A Doc object is basically a row in a database, except make it fashion. She's made up of one or more fields, and every single one of those fields has a value. That's it, that's the whole vibe. πŸ¦‹


πŸŽ€ CONSTRUCTORS πŸŽ€

new

my $doc = Lucy::Document::Doc->new(
    fields => { foo => 'foo foo', bar => 'bar bar' },
);

Create a new Document. Main character behavior, honestly. πŸ‘‘

  • fields β€” Field-value pairs. The whole point, fr fr.
  • doc_id β€” Internal Lucy document id. Defaults to 0, which is an invalid doc id, so like… a placeholder id, not a real one. πŸ™ˆ

πŸ”₯ METHODS πŸ”₯

set_doc_id

$doc->set_doc_id($doc_id);

Set the internal Lucy document id. Giving her an identity, we love to see it.

get_doc_id

my $int = $doc->get_doc_id();

Retrieve the internal Lucy document id. Where my id at, bestie.

store

$doc->store($field, $value);

Store a field value in the Doc. Tucking it away safely, no cap.

  • field β€” The field name.
  • value β€” The value.

get_fields

my $hashref = $doc->get_fields();

Return the Doc's backing fields hash. The whole group chat, exposed. 😭

get_size

my $int = $doc->get_size();

Return the number of fields in the Doc. She's counting her friends. 🫢

extract

my $obj = $doc->extract($field);

Retrieve the field's value, or NULL if the field is not present. If she's not there, she's just not there. πŸ’€

field_names

my $arrayref = $doc->field_names();

Return a list of names of all fields present. Roll call! ⭐


πŸ‘‘ INHERITANCE πŸ‘‘

Lucy::Document::Doc isa Clownfish::Obj. Family lineage, iconic.


Okay so that's the whole page, and it ate, obviously. This was Lucy::...nt::Doc(3pm) from the User Contributed Perl Documentation, generated by perl v5.42.0 on 2025-07-25. Go forth and index your little heart out. Periodt. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from