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

Lucy::Simple

parcel Lucy
class variable LUCY_SIMPLE
struct symbol lucy_Simple
class nickname lucy_Simple
header file Lucy/Simple.h

Name

Lucy::Simple – Basic search engine.

Description

Lucy::Simple is a stripped-down interface for the Apache Lucy search engine library.

Functions

new
lucy_Simple*
lucy_Simple_new(
    cfish_Obj *path,
    cfish_String *language
);

Create a Lucy::Simple object, which can be used for both indexing and searching. Both parameters path and language are required.

path

Where the index directory should be located. If no index is found at the specified location, one will be created.

language

The language of the documents in your collection, indicated by a two-letter ISO code. 12 languages are supported:

|-----------------------|
| Language   | ISO code |
|-----------------------|
| Danish     | da       |
| Dutch      | nl       |
| English    | en       |
| Finnish    | fi       |
| French     | fr       |
| German     | de       |
| Italian    | it       |
| Norwegian  | no       |
| Portuguese | pt       |
| Spanish    | es       |
| Swedish    | sv       |
| Russian    | ru       |
|-----------------------|
init
lucy_Simple*
lucy_Simple_init(
    lucy_Simple *self,
    cfish_Obj *path,
    cfish_String *language
);

Initialize a Lucy::Simple object.

Methods

Add_Doc
void
lucy_Simple_Add_Doc(
    lucy_Simple *self,
    lucy_Doc *doc
);

Add a document to the index.

uint32_t
lucy_Simple_Search(
    lucy_Simple *self,
    cfish_String *query,
    uint32_t offset,
    uint32_t num_wanted,
    lucy_SortSpec *sort_spec
);

Search the index. Returns the total number of documents which match the query. (This number is unlikely to match num_wanted.)

query

A search query string.

offset

The number of most-relevant hits to discard, typically used when “paging” through hits N at a time. Setting offset to 20 and num_wanted to 10 retrieves hits 21-30, assuming that 30 hits can be found.

num_wanted

The number of hits you would like to see after offset is taken into account.

sort_spec

A SortSpec, which will affect how results are ranked and returned.

Next
lucy_HitDoc* // incremented
lucy_Simple_Next(
    lucy_Simple *self
);

Return the next hit, or NULL when the iterator is exhausted.

Inheritance

Lucy::Simple is a Clownfish::Obj.