mirror of https://github.com/apache/lucene.git
share single IndexSearcher instance in ReadTask
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@762307 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3fc80aa239
commit
bddac65336
|
@ -28,6 +28,7 @@ import org.apache.lucene.benchmark.byTask.utils.Config;
|
|||
import org.apache.lucene.benchmark.byTask.utils.FileUtils;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.search.IndexSearcher;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.FSDirectory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
@ -68,6 +69,7 @@ public class PerfRunData {
|
|||
private Class qmkrClass;
|
||||
|
||||
private IndexReader indexReader;
|
||||
private IndexSearcher indexSearcher;
|
||||
private IndexWriter indexWriter;
|
||||
private Config config;
|
||||
private long startTimeMillis;
|
||||
|
@ -182,11 +184,23 @@ public class PerfRunData {
|
|||
return indexReader;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the indexSearcher.
|
||||
*/
|
||||
public IndexSearcher getIndexSearcher() {
|
||||
return indexSearcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param indexReader The indexReader to set.
|
||||
*/
|
||||
public void setIndexReader(IndexReader indexReader) {
|
||||
this.indexReader = indexReader;
|
||||
if (indexReader != null) {
|
||||
indexSearcher = new IndexSearcher(indexReader);
|
||||
} else {
|
||||
indexSearcher = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -89,7 +89,12 @@ public abstract class ReadTask extends PerfTask {
|
|||
|
||||
if (withSearch()) {
|
||||
res++;
|
||||
IndexSearcher searcher = new IndexSearcher(ir);
|
||||
final IndexSearcher searcher;
|
||||
if (closeReader) {
|
||||
searcher = new IndexSearcher(ir);
|
||||
} else {
|
||||
searcher = getRunData().getIndexSearcher();
|
||||
}
|
||||
QueryMaker queryMaker = getQueryMaker();
|
||||
Query q = queryMaker.makeQuery();
|
||||
Sort sort = getSort();
|
||||
|
|
Loading…
Reference in New Issue