You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/03/19 19:28:13 UTC
[lucy-commits] svn commit: r1083247 - in /incubator/lucy/trunk/devel/benchmarks/indexers:
BenchmarkingIndexer.pm plucene_indexer.plx
Author: marvin
Date: Sat Mar 19 18:28:13 2011
New Revision: 1083247
URL: http://svn.apache.org/viewvc?rev=1083247&view=rev
Log:
Remove Plucene-related benchmarking code.
Removed:
incubator/lucy/trunk/devel/benchmarks/indexers/plucene_indexer.plx
Modified:
incubator/lucy/trunk/devel/benchmarks/indexers/BenchmarkingIndexer.pm
Modified: incubator/lucy/trunk/devel/benchmarks/indexers/BenchmarkingIndexer.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/devel/benchmarks/indexers/BenchmarkingIndexer.pm?rev=1083247&r1=1083246&r2=1083247&view=diff
==============================================================================
--- incubator/lucy/trunk/devel/benchmarks/indexers/BenchmarkingIndexer.pm (original)
+++ incubator/lucy/trunk/devel/benchmarks/indexers/BenchmarkingIndexer.pm Sat Mar 19 18:28:13 2011
@@ -223,86 +223,4 @@ sub build_index {
return ( $count, $secs );
}
-package BenchmarkingIndexer::Plucene;
-use base qw( BenchmarkingIndexer );
-
-use Time::HiRes qw( gettimeofday );
-
-sub new {
- my $class = shift;
- my $self = $class->SUPER::new(@_);
-
- require Plucene;
- require Plucene::Document;
- require Plucene::Document::Field;
- require Plucene::Index::Writer;
- require Plucene::Analysis::WhitespaceAnalyzer;
-
- $self->{index_dir} = 'plucene_index';
- $self->{engine} = 'Plucene';
- $self->{version} = $Plucene::VERSION;
-
- return $self;
-}
-
-sub init_indexer {
- my ( $self, $count ) = @_;
- my $create = $count ? 0 : 1;
- my $writer = Plucene::Index::Writer->new( $self->{index_dir},
- Plucene::Analysis::WhitespaceAnalyzer->new(), $create );
- $writer->set_mergefactor(1000);
- return $writer;
-}
-
-# Build an index, stopping at $max docs if $max > 0.
-sub build_index {
- my $self = shift;
- $self->delayed_init;
- my ( $max, $increment, $article_filepaths )
- = @{$self}{qw( docs increment article_filepaths )};
-
- # Cause text to be stored if spec'd.
- my $field_constructor = $self->{store} ? 'Text' : 'UnStored';
-
- # Start timer.
- my $start = gettimeofday();
-
- my $writer = $self->init_indexer(0);
-
- my $count = 0;
- while ( $count < $max ) {
- for my $article_filepath (@$article_filepaths) {
- # The title is the first line, the body is the rest.
- open( my $article_fh, '<', $article_filepath )
- or die "Can't open file '$article_filepath'";
- my $title = <$article_fh>;
- my $body = do { local $/; <$article_fh> };
-
- # Add content to index.
- my $doc = Plucene::Document->new;
- $doc->add( Plucene::Document::Field->Text( title => $title ) );
- $doc->add(
- Plucene::Document::Field->$field_constructor( body => $body )
- );
- $writer->add_document($doc);
-
- # Bail if we've reached spec'd number of docs.
- $count++;
- last if ( $count >= $max );
- if ( $count % $increment == 0 and $count ) {
- undef $writer;
- $writer = $self->init_indexer($count);
- }
- }
- }
-
- # Finish index.
- $writer->optimize;
-
- # Return elapsed seconds.
- my $end = gettimeofday();
- my $secs = $end - $start;
- return ( $count, $secs );
-}
-
1;