lucy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Wellnhofer <wellnho...@aevum.de>
Subject Re: [lucy-user] Documents gone AWOL
Date Mon, 30 Sep 2013 16:42:15 GMT
On 30/09/2013 18:22, Kieron Taylor wrote:
> On 30/09/2013 16:45, Peter Karman wrote:
>> show your code, please.
>
> Doing my best to extract something close enough to the original code.
> Lots of Moose and fluff culled.
>
> %%% Schema generation %%%
>
> $schema = Lucy::Plan::Schema->new;
> $lucy_str = Lucy::Plan::StringType->new;
>
> # schema generated from Moose MOP
> for my $attribute ($record_meta->get_all_attributes) {
>      $schema->spec_field( name => $attribute->name, type => $lucy_str);
> }
>
> %%% Indexing %%%
>
> $lucy_indexer = Lucy::Index::Indexer->new(
>              schema => $schema,
>              index => $path,
>              create => 1,
> );
>
> #
> while ($record = shift) {
>
>    %flattened_record = %{$record};
>    $flattened_record{accessions} = join ' ',@accessions;
>    # Array of values turned into whitespaced list.
>    $lucy_indexer->add_doc(
>            \%flattened_record
>    );
>
> }

If the 'accessions' field contains multiple terms, you should use a 
FullTextType with an appropriate Analyzer, not a StringType.

Nick

Mime
View raw message