Thanks! I'll look at this more as I get the code closer to working. Are you familiar with the Wikipedia benchmark for Lucene that he was using? Have you tried running Lucy on it?
--nate On Thu, Jun 20, 2013 at 3:42 PM, Marvin Humphrey <[email protected]> wrote: > On Thu, Jun 20, 2013 at 2:37 PM, Marvin Humphrey <[email protected]> > wrote: > >> I'll attempt to attach the script to this email, but I don't recall whether >> our >> dev list strips attachments. If it doesn't survive, I'll follow up with >> another post containing the sample code inlined in the message body. > > Our dev list strips email attachments. The script is below. > > Marvin Humphrey > > > # Licensed to the public under the Apache License, Version 2.0. > > use strict; > use warnings; > use Lucy; > use LucyX::Index::ByteBufDocWriter; > use LucyX::Index::ByteBufDocReader; > > package MyArchitecture; > use base qw( Lucy::Plan::Architecture ); > > sub init_seg_writer { > my ($self, $seg_writer) = @_; > my $doc_writer = LucyX::Index::ByteBufDocWriter->new( > field => 'value', > width => 12, > schema => $seg_writer->get_schema, > snapshot => $seg_writer->get_snapshot, > segment => $seg_writer->get_segment, > polyreader => $seg_writer->get_polyreader, > ); > $seg_writer->add_writer($doc_writer); > $seg_writer->register( > api => 'Lucy::Index::DocReader', > component => $doc_writer, > ); > } > > sub init_seg_reader { > my ($self, $seg_reader) = @_; > my $doc_reader = LucyX::Index::ByteBufDocReader->new( > field => 'value', > width => 12, > schema => $seg_reader->get_schema, > folder => $seg_reader->get_folder, > segments => $seg_reader->get_segments, > seg_tick => $seg_reader->get_seg_tick, > snapshot => $seg_reader->get_snapshot, > ); > $seg_reader->register( > api => 'Lucy::Index::DocReader', > component => $doc_reader, > ); > } > > package MySchema; > use base qw( Lucy::Plan::Schema ); > > sub architecture { MyArchitecture->new } > > package main; > > my $schema = MySchema->new; > my $type = Lucy::Plan::StringType->new; > $schema->spec_field(name => 'value', type => $type); > > my $index = shift @ARGV or die "usage: custom_arch.pl INDEX_LOCATION"; > > my $indexer = Lucy::Index::Indexer->new( > index => $index, > schema => $schema, > create => 1, > truncate => 1, > ); > > $indexer->add_doc({value => 'hello, world'}); > $indexer->commit; > > my $searcher = Lucy::Search::IndexSearcher->new(index => $index); > my $doc = $searcher->fetch_doc(1); > print "$doc->{value}\n";
