LUCENE-1492: add optional readOnly param to OpenReader task

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@727029 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2008-12-16 11:44:01 +00:00
parent 1f33d7c66a
commit 09f661c48c
3 changed files with 16 additions and 3 deletions

View File

@ -4,6 +4,9 @@ The Benchmark contrib package contains code for benchmarking Lucene in a variety
$Id:$
12/16/08
LUCENE-1492: Added optional readOnly param (default true) to OpenReader task.
9/9/08
LUCENE-1243: Added new sorting benchmark capabilities. Also Reopen and commit tasks. (Mark Miller via Grant Ingersoll)

View File

@ -29,15 +29,25 @@ import org.apache.lucene.store.Directory;
*/
public class OpenReaderTask extends PerfTask {
private boolean readOnly = true;
public OpenReaderTask(PerfRunData runData) {
super(runData);
}
public int doLogic() throws IOException {
Directory dir = getRunData().getDirectory();
IndexReader reader = IndexReader.open(dir);
IndexReader reader = IndexReader.open(dir, readOnly);
getRunData().setIndexReader(reader);
return 1;
}
public void setParams(String params) {
super.setParams(params);
readOnly = Boolean.valueOf(params).booleanValue();
}
public boolean supportsParams() {
return true;
}
}

View File

@ -109,7 +109,7 @@ public class TestPerfTasksLogic extends TestCase {
"{ AddDoc } : 1000",
"Optimize",
"CloseIndex",
"OpenReader",
"OpenReader(true)",
"{ CountingHighlighterTest(size[1],highlight[1],mergeContiguous[true],maxFrags[1],fields[body]) } : 200",
"CloseReader",
};
@ -147,7 +147,7 @@ public class TestPerfTasksLogic extends TestCase {
"{ AddDoc } : 1000",
"Optimize",
"CloseIndex",
"OpenReader",
"OpenReader(false)",
"{ CountingHighlighterTest(size[1],highlight[1],mergeContiguous[true],maxFrags[1],fields[body]) } : 200",
"CloseReader",
};