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

Lucy::Plan::Schema

parcel Lucy
class variable LUCY_SCHEMA
struct symbol lucy_Schema
class nickname lucy_Schema
header file Lucy/Plan/Schema.h

Name

Lucy::Plan::Schema – User-created specification for an inverted index.

Description

A Schema is a specification which indicates how other entities should interpret the raw data in an inverted index and interact with it.

Once an actual index has been created using a particular Schema, existing field definitions may not be changed. However, it is possible to add new fields during subsequent indexing sessions.

Functions

new
lucy_Schema* // incremented
lucy_Schema_new(void);

Constructor. Takes no arguments.

init
lucy_Schema*
lucy_Schema_init(
    lucy_Schema *self
);

Initialize a Schema.

Methods

Architecture
lucy_Architecture* // incremented
lucy_Schema_Architecture(
    lucy_Schema *self
);

Factory method which creates an Architecture object for this index.

Spec_Field
void
lucy_Schema_Spec_Field(
    lucy_Schema *self,
    cfish_String *name,
    lucy_FieldType *type
);

Define the behavior of a field by associating it with a FieldType.

If this method has already been called for the supplied field, it will merely test to verify that the supplied FieldType Equals() the existing one.

name

The name of the field.

type

A FieldType.

Fetch_Type
lucy_FieldType*
lucy_Schema_Fetch_Type(
    lucy_Schema *self,
    cfish_String *field
);

Return the FieldType for the specified field. If the field can’t be found, return NULL.

Fetch_Sim
lucy_Similarity*
lucy_Schema_Fetch_Sim(
    lucy_Schema *self,
    cfish_String *field
);

Return the Similarity for the specified field, or NULL if either the field can’t be found or it isn’t associated with a Similarity.

Num_Fields
uint32_t
lucy_Schema_Num_Fields(
    lucy_Schema *self
);

Return the number of fields currently defined.

All_Fields
cfish_Vector* // incremented
lucy_Schema_All_Fields(
    lucy_Schema *self
);

Return all the Schema’s field names as an array.

Get_Architecture
lucy_Architecture*
lucy_Schema_Get_Architecture(
    lucy_Schema *self
);

Return the Schema instance’s internal Architecture object.

Get_Similarity
lucy_Similarity*
lucy_Schema_Get_Similarity(
    lucy_Schema *self
);

Return the Schema instance’s internal Similarity object.

Inheritance

Lucy::Plan::Schema is a Clownfish::Obj.