This project has retired. For details please refer to its Attic page.
Lucy::Document::Doc – C API Documentation
Apache Lucy™

Lucy::Document::Doc

parcel Lucy
class variable LUCY_DOC
struct symbol lucy_Doc
class nickname lucy_Doc
header file Lucy/Document/Doc.h

Name

Lucy::Document::Doc – A document.

Description

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

Functions

new
lucy_Doc* // incremented
lucy_Doc_new(
    void *fields,
    int32_t doc_id
);

Create a new Document.

fields

Field-value pairs.

doc_id

Internal Lucy document id. Default of 0 (an invalid doc id).

init
lucy_Doc*
lucy_Doc_init(
    lucy_Doc *self,
    void *fields,
    int32_t doc_id
);

Initialize a Document.

fields

Field-value pairs.

doc_id

Internal Lucy document id. Default of 0 (an invalid doc id).

Methods

Set_Doc_ID
void
lucy_Doc_Set_Doc_ID(
    lucy_Doc *self,
    int32_t doc_id
);

Set internal Lucy document id.

Get_Doc_ID
int32_t
lucy_Doc_Get_Doc_ID(
    lucy_Doc *self
);

Retrieve internal Lucy document id.

Store
void
lucy_Doc_Store(
    lucy_Doc *self,
    cfish_String *field,
    cfish_Obj *value
);

Store a field value in the Doc.

field

The field name

value

The value

Get_Fields
void*
lucy_Doc_Get_Fields(
    lucy_Doc *self
);

Return the Doc’s backing fields hash.

Get_Size
uint32_t
lucy_Doc_Get_Size(
    lucy_Doc *self
);

Return the number of fields in the Doc.

Extract
cfish_Obj* // incremented
lucy_Doc_Extract(
    lucy_Doc *self,
    cfish_String *field
);

Retrieve the field’s value, or NULL if the field is not present.

Field_Names
cfish_Vector* // incremented
lucy_Doc_Field_Names(
    lucy_Doc *self
);

Return a list of names of all fields present.

Equals
bool
lucy_Doc_Equals(
    lucy_Doc *self,
    cfish_Obj *other
);

Indicate whether two objects are the same. By default, compares the memory address.

other

Another Obj.

Inheritance

Lucy::Document::Doc is a Clownfish::Obj.