Lucy::...nt::Doc(3pm)
β¨ 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 to0, 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
- fedora 43: perl-Lucy 0.6.2-26.fc43 Β· Apache-2.0 AND MIT AND Unicode-DFS-2015
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms