lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r762307 - in /lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask: PerfRunData.java tasks/ReadTask.java
Date Mon, 06 Apr 2009 12:20:43 GMT
Author: mikemccand
Date: Mon Apr  6 12:20:42 2009
New Revision: 762307

URL: http://svn.apache.org/viewvc?rev=762307&view=rev
Log:
share single IndexSearcher instance in ReadTask

Modified:
    lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java
    lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java

Modified: lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java?rev=762307&r1=762306&r2=762307&view=diff
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java
(original)
+++ lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java
Mon Apr  6 12:20:42 2009
@@ -28,6 +28,7 @@
 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 @@
   private Class qmkrClass;
 
   private IndexReader indexReader;
+  private IndexSearcher indexSearcher;
   private IndexWriter indexWriter;
   private Config config;
   private long startTimeMillis;
@@ -183,10 +185,22 @@
   }
 
   /**
+   * @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;
+    }
   }
 
   /**

Modified: lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java?rev=762307&r1=762306&r2=762307&view=diff
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java
(original)
+++ lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java
Mon Apr  6 12:20:42 2009
@@ -89,7 +89,12 @@
 
     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();



Mime
View raw message