1Lucy::Document::Doc(3)User Contributed Perl DocumentationLucy::Document::Doc(3)
2
3
4

NAME

6       Lucy::Document::Doc - A document.
7

SYNOPSIS

9           my $doc = Lucy::Document::Doc->new(
10               fields => { foo => 'foo foo', bar => 'bar bar' },
11           );
12           $indexer->add_doc($doc);
13
14       Doc objects allow access to field values via hashref overloading:
15
16           $doc->{foo} = 'new value for field "foo"';
17           print "foo: $doc->{foo}\n";
18

DESCRIPTION

20       A Doc object is akin to a row in a database, in that it is made up of
21       one or more fields, each of which has a value.
22

CONSTRUCTORS

24   new
25           my $doc = Lucy::Document::Doc->new(
26               fields => { foo => 'foo foo', bar => 'bar bar' },
27           );
28
29       Create a new Document.
30
31fields - Field-value pairs.
32
33doc_id - Internal Lucy document id.  Default of 0 (an invalid doc
34           id).
35

METHODS

37   set_doc_id
38           $doc->set_doc_id($doc_id);
39
40       Set internal Lucy document id.
41
42   get_doc_id
43           my $int = $doc->get_doc_id();
44
45       Retrieve internal Lucy document id.
46
47   store
48           $doc->store($field, $value);
49
50       Store a field value in the Doc.
51
52field - The field name.
53
54value - The value.
55
56   get_fields
57           my $hashref = $doc->get_fields();
58
59       Return the Doc's backing fields hash.
60
61   get_size
62           my $int = $doc->get_size();
63
64       Return the number of fields in the Doc.
65
66   extract
67           my $obj = $doc->extract($field);
68
69       Retrieve the fieldXs value, or NULL if the field is not present.
70
71   field_names
72           my $arrayref = $doc->field_names();
73
74       Return a list of names of all fields present.
75

INHERITANCE

77       Lucy::Document::Doc isa Clownfish::Obj.
78
79
80
81perl v5.32.1                      2021-01-27            Lucy::Document::Doc(3)
Impressum