LUCENE-5825: new benchmark codec.postingsFormat option

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1612765 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David Wayne Smiley 2014-07-23 04:43:34 +00:00
parent f94f4952a7
commit 430c264afa
5 changed files with 25 additions and 1 deletions

View File

@ -125,6 +125,9 @@ New Features
McCandless)
* LUCENE-5835: TermValComparator can sort missing values last. (Adrien Grand)
* LUCENE-5825: Benchmark module can use custom postings format, e.g.:
codec.postingsFormat=Memory (Varun Shenoy, David Smiley)
API Changes

View File

@ -173,6 +173,7 @@
<pathelement path="${facet.jar}"/>
<pathelement path="${spatial.jar}"/>
<pathelement path="${queries.jar}"/>
<pathelement path="${codecs.jar}"/>
<path refid="base.classpath"/>
<fileset dir="lib"/>
</path>
@ -274,7 +275,7 @@
<echo>Benchmark output in JIRA table format is in file: ${shingle.jira.output.file}</echo>
</target>
<target name="init" depends="module-build.init,jar-memory,jar-highlighter,jar-analyzers-common,jar-queryparser,jar-facet,jar-spatial"/>
<target name="init" depends="module-build.init,jar-memory,jar-highlighter,jar-analyzers-common,jar-queryparser,jar-facet,jar-spatial,jar-codecs"/>
<target name="compile-test" depends="copy-alg-files-for-testing,module-build.compile-test"/>
<target name="copy-alg-files-for-testing" description="copy .alg files as resources for testing">

View File

@ -29,12 +29,14 @@ doc.maker=org.apache.lucene.benchmark.byTask.feeds.SpatialDocMaker
#spatial.worldBounds=...
# Spatial Grid: (PrefixTree) see SpatialPrefixTreeFactory.makeSPT
#spatial.prefixTree=geohash (or quad)
spatial.prefixTree=quad
#spatial.maxLevels=11
#spatial.maxDistErr (in degrees) to compute maxLevels -- defaults to 1 meter's worth
# RecursivePrefixTreeStrategy:
spatial.docPointsOnly=true
#spatial.distErrPct=.25
#spatial.prefixGridScanLevel=-4
#codec.postingsFormat=Memory or (Direct)
### Source & Doc
content.source=org.apache.lucene.benchmark.byTask.feeds.LineDocSource

View File

@ -587,6 +587,7 @@ Here is a list of currently defined properties:
</li><li>max.buffered
</li><li>directory
</li><li>ram.flush.mb
</li><li>codec.postingsFormat (eg Direct) Note: no codec should be specified through default.codec
</li></ul>
</li>

View File

@ -20,6 +20,8 @@ package org.apache.lucene.benchmark.byTask.tasks;
import org.apache.lucene.benchmark.byTask.PerfRunData;
import org.apache.lucene.benchmark.byTask.utils.Config;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.codecs.lucene49.Lucene49Codec;
import org.apache.lucene.index.ConcurrentMergeScheduler;
import org.apache.lucene.index.IndexCommit;
import org.apache.lucene.index.IndexDeletionPolicy;
@ -135,6 +137,21 @@ public class CreateIndexTask extends PerfTask {
}
}
final String postingsFormat = config.get("codec.postingsFormat",null);
if (defaultCodec == null && postingsFormat != null) {
try {
final PostingsFormat postingsFormatChosen = PostingsFormat.forName(postingsFormat);
iwConf.setCodec(new Lucene49Codec(){
@Override
public PostingsFormat getPostingsFormatForField(String field) {
return postingsFormatChosen;
}
});
} catch (Exception e) {
throw new RuntimeException("Couldn't instantiate Postings Format: " + postingsFormat, e);
}
}
final String mergePolicy = config.get("merge.policy",
"org.apache.lucene.index.LogByteSizeMergePolicy");
boolean isCompound = config.get("compound", true);