incubator-lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marvin Humphrey <mar...@rectangular.com>
Subject Re: [lucy-dev] ElasticSearch
Date Mon, 06 Dec 2010 23:26:33 GMT
On Mon, Dec 06, 2010 at 11:54:32PM +0100, Dobrica Pavlinusic wrote:
> Which leads me to practical question: what's current state of schema in
> KinoSearch and/or lucy?
> 
> I seems to remember API for adding fields on the fly while indexing in
> older version of KinoSearch, but I can't find anything similar in
> documentation for 0.31.
> 
> I would love to index CouchDB _changes feed with (much like
> ElasticSearch CouchDB river) but I don't really know schema in advance.

Dynamic schemas are supported, same as in KS 0.2x.  Supplying a document with
an unknown field still triggers an exception, so you just have to iterate over
all fields in the unknown document and call spec_field() for anything which
hasn't been seen before.

    while (my $doc = get_next_doc_from_somewhere()) {
        for my $field (keys %$doc) {
            next if $schema->fetch_type($field);
            $schema->spec_field(name => $field, type => $type);
        }
        $indexer->add_doc($doc);
    }
    $indexer->commit;

Marvin Humphrey


Mime
View raw message