org.apache.lucene.benchmark.standard

Class StandardBenchmarker

public class StandardBenchmarker extends AbstractBenchmarker implements Benchmarker

Deprecated: use the byTask code instead. See http://lucene.zones.apache.org:8080/hudson/job/Lucene-Nightly/javadoc/org/apache/lucene/benchmark/byTask/package-summary.html .

Reads in the Reuters Collection, downloaded from http://www.daviddlewis.com/resources/testcollections/reuters21578/reuters21578.tar.gz in the workingDir/reuters and indexes them using the StandardAnalyzer

Runs a standard set of documents through an Indexer and then runs a standard set of queries against the index.

See Also:

Field Summary
static StringINDEX_DIR
static StringSOURCE_DIR
Constructor Summary
StandardBenchmarker()
Method Summary
TestData[]benchmark(File workingDir, BenchmarkOptions opts)
static Query[]createQueries(List qs, Analyzer a)
Parse the strings containing Lucene queries.
static voidgetAllFiles(File srcDir, FileFilter filter, List allFiles)
protected FilegetSourceDirectory(File workingDir)
protected DocumentmakeDocument(File in, String[] tags, boolean stored, boolean tokenized, boolean tfv)
Parse the Reuters SGML and index: Date, Title, Dateline, Body
protected voidmakeIndex(TestRunData trd, File srcDir, IndexWriter iw, boolean stored, boolean tokenized, boolean tfv, StandardOptions options)
Make index, and collect time data.
protected voidreset(File indexDir)
Remove existing index.
protected voidrunBenchmark(TestData params, StandardOptions options)
Run benchmark using supplied parameters.
protected voidsaveStream(InputStream is, File out, boolean closeInput)
Save a stream to a file.

Field Detail

INDEX_DIR

public static final String INDEX_DIR

SOURCE_DIR

public static final String SOURCE_DIR

Constructor Detail

StandardBenchmarker

public StandardBenchmarker()

Method Detail

benchmark

public TestData[] benchmark(File workingDir, BenchmarkOptions opts)

createQueries

public static Query[] createQueries(List qs, Analyzer a)
Parse the strings containing Lucene queries.

Parameters: qs array of strings containing query expressions a analyzer to use when parsing queries

Returns: array of Lucene queries

getAllFiles

public static void getAllFiles(File srcDir, FileFilter filter, List allFiles)

getSourceDirectory

protected File getSourceDirectory(File workingDir)

makeDocument

protected Document makeDocument(File in, String[] tags, boolean stored, boolean tokenized, boolean tfv)
Parse the Reuters SGML and index: Date, Title, Dateline, Body

Parameters: in input file

Returns: Lucene document

makeIndex

protected void makeIndex(TestRunData trd, File srcDir, IndexWriter iw, boolean stored, boolean tokenized, boolean tfv, StandardOptions options)
Make index, and collect time data.

Parameters: trd run data to populate srcDir directory with source files iw index writer, already open stored store values of fields tokenized tokenize fields tfv store term vectors

Throws: Exception

reset

protected void reset(File indexDir)
Remove existing index.

Throws: Exception

runBenchmark

protected void runBenchmark(TestData params, StandardOptions options)
Run benchmark using supplied parameters.

Parameters: params benchmark parameters

Throws: Exception

saveStream

protected void saveStream(InputStream is, File out, boolean closeInput)
Save a stream to a file.

Parameters: is input stream out output file closeInput if true, close the input stream when done.

Throws: Exception

Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.