Project Lucy has retired. For details please refer to its Attic page.
Lucy::Index::IndexReader – C API Documentation
Apache Lucy™

Lucy::Index::IndexReader

parcel Lucy
class variable LUCY_INDEXREADER
struct symbol lucy_IndexReader
class nickname lucy_IxReader
header file Lucy/Index/IndexReader.h

Name

Lucy::Index::IndexReader – Read from an inverted index.

Description

IndexReader is the interface through which IndexSearcher objects access the content of an index.

IndexReader objects always represent a point-in-time view of an index as it existed at the moment the reader was created. If you want search results to reflect modifications to an index, you must create a new IndexReader after the update process completes.

IndexReaders are composites; most of the work is done by individual DataReader sub-components, which may be accessed via Fetch() and Obtain(). The most efficient and powerful access to index data happens at the segment level via SegReader’s sub-components.

Functions

open
lucy_IndexReader* // incremented
lucy_IxReader_open(
    cfish_Obj *index,
    lucy_Snapshot *snapshot,
    lucy_IndexManager *manager
);

IndexReader is an abstract base class; open() returns the IndexReader subclass PolyReader, which channels the output of 0 or more SegReaders.

index

Either a string filepath or a Folder.

snapshot

A Snapshot. If not supplied, the most recent snapshot file will be used.

manager

An IndexManager. Read-locking is off by default; supplying this argument turns it on.

do_open
lucy_IndexReader*
lucy_IxReader_do_open(
    lucy_IndexReader *self,
    cfish_Obj *index,
    lucy_Snapshot *snapshot,
    lucy_IndexManager *manager
);

Initialize and open an IndexReader.

index

Either a string filepath or a Folder.

snapshot

A Snapshot. If not supplied, the most recent snapshot file will be used.

manager

An IndexManager. Read-locking is off by default; supplying this argument turns it on.

Methods

Doc_Max (abstract)
int32_t
lucy_IxReader_Doc_Max(
    lucy_IndexReader *self
);

Return the maximum number of documents available to the reader, which is also the highest possible internal document id. Documents which have been marked as deleted but not yet purged from the index are included in this count.

Doc_Count (abstract)
int32_t
lucy_IxReader_Doc_Count(
    lucy_IndexReader *self
);

Return the number of documents available to the reader, subtracting any that are marked as deleted.

Del_Count (abstract)
int32_t
lucy_IxReader_Del_Count(
    lucy_IndexReader *self
);

Return the number of documents which have been marked as deleted but not yet purged from the index.

Offsets (abstract)
lucy_I32Array* // incremented
lucy_IxReader_Offsets(
    lucy_IndexReader *self
);

Return an array with one entry for each segment, corresponding to segment doc_id start offset.

Seg_Readers (abstract)
cfish_Vector* // incremented
lucy_IxReader_Seg_Readers(
    lucy_IndexReader *self
);

Return an array of all the SegReaders represented within the IndexReader.

Obtain
lucy_DataReader*
lucy_IxReader_Obtain(
    lucy_IndexReader *self,
    cfish_String *api
);

Fetch a component, or throw an error if the component can’t be found.

api

The name of the DataReader subclass that the desired component must implement.

Fetch
lucy_DataReader*
lucy_IxReader_Fetch(
    lucy_IndexReader *self,
    cfish_String *api
);

Fetch a component, or return NULL if the component can’t be found.

api

The name of the DataReader subclass that the desired component must implement.

Methods inherited from Lucy::Index::DataReader

Aggregator (abstract)
lucy_DataReader* // incremented
lucy_IxReader_Aggregator(
    lucy_IndexReader *self,
    cfish_Vector *readers,
    lucy_I32Array *offsets
);

Create a reader which aggregates the output of several lower level readers. Return NULL if such a reader is not valid.

readers

An array of DataReaders.

offsets

Doc id start offsets for each reader.

Get_Schema
lucy_Schema*
lucy_IxReader_Get_Schema(
    lucy_IndexReader *self
);

Accessor for “schema” member var.

Get_Folder
lucy_Folder*
lucy_IxReader_Get_Folder(
    lucy_IndexReader *self
);

Accessor for “folder” member var.

Get_Snapshot
lucy_Snapshot*
lucy_IxReader_Get_Snapshot(
    lucy_IndexReader *self
);

Accessor for “snapshot” member var.

Get_Segments
cfish_Vector*
lucy_IxReader_Get_Segments(
    lucy_IndexReader *self
);

Accessor for “segments” member var.

Get_Segment
lucy_Segment*
lucy_IxReader_Get_Segment(
    lucy_IndexReader *self
);

Accessor for “segment” member var.

Get_Seg_Tick
int32_t
lucy_IxReader_Get_Seg_Tick(
    lucy_IndexReader *self
);

Accessor for “seg_tick” member var.

Inheritance

Lucy::Index::IndexReader is a Lucy::Index::DataReader is a Clownfish::Obj.