lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1055595 - /lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/IndexSearcher.java
Date Wed, 05 Jan 2011 19:27:52 GMT
Author: mikemccand
Date: Wed Jan  5 19:27:51 2011
New Revision: 1055595

URL: http://svn.apache.org/viewvc?rev=1055595&view=rev
Log:
LUCENE-2837: small code cleanup

Modified:
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/IndexSearcher.java

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/IndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/IndexSearcher.java?rev=1055595&r1=1055594&r2=1055595&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/IndexSearcher.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/IndexSearcher.java Wed Jan 
5 19:27:51 2011
@@ -371,7 +371,7 @@ public class IndexSearcher {
     
       for (int i = 0; i < subReaders.length; i++) { // search each sub
         runner.submit(
-                      new MultiSearcherCallableNoSort(lock, subSearchers[i], weight, filter,
nDocs, hq, i, docStarts));
+                      new MultiSearcherCallableNoSort(lock, subSearchers[i], weight, filter,
nDocs, hq, docStarts[i]));
       }
 
       int totalHits = 0;
@@ -440,7 +440,7 @@ public class IndexSearcher {
       final ExecutionHelper<TopFieldDocs> runner = new ExecutionHelper<TopFieldDocs>(executor);
       for (int i = 0; i < subReaders.length; i++) { // search each sub
         runner.submit(
-                      new MultiSearcherCallableWithSort(lock, subSearchers[i], weight, filter,
nDocs, hq, sort, i, docStarts));
+                      new MultiSearcherCallableWithSort(lock, subSearchers[i], weight, filter,
nDocs, hq, sort, docStarts[i]));
       }
       int totalHits = 0;
       float maxScore = Float.NEGATIVE_INFINITY;
@@ -626,20 +626,18 @@ public class IndexSearcher {
     private final Weight weight;
     private final Filter filter;
     private final int nDocs;
-    private final int i;
     private final HitQueue hq;
-    private final int[] starts;
+    private final int docBase;
 
     public MultiSearcherCallableNoSort(Lock lock, IndexSearcher searchable, Weight weight,
-        Filter filter, int nDocs, HitQueue hq, int i, int[] starts) {
+        Filter filter, int nDocs, HitQueue hq, int docBase) {
       this.lock = lock;
       this.searchable = searchable;
       this.weight = weight;
       this.filter = filter;
       this.nDocs = nDocs;
       this.hq = hq;
-      this.i = i;
-      this.starts = starts;
+      this.docBase = docBase;
     }
 
     public TopDocs call() throws IOException {
@@ -647,7 +645,7 @@ public class IndexSearcher {
       final ScoreDoc[] scoreDocs = docs.scoreDocs;
       for (int j = 0; j < scoreDocs.length; j++) { // merge scoreDocs into hq
         final ScoreDoc scoreDoc = scoreDocs[j];
-        scoreDoc.doc += starts[i]; // convert doc 
+        scoreDoc.doc += docBase; // convert doc 
         //it would be so nice if we had a thread-safe insert 
         lock.lock();
         try {
@@ -672,21 +670,19 @@ public class IndexSearcher {
     private final Weight weight;
     private final Filter filter;
     private final int nDocs;
-    private final int i;
     private final FieldDocSortedHitQueue hq;
-    private final int[] starts;
+    private final int docBase;
     private final Sort sort;
 
     public MultiSearcherCallableWithSort(Lock lock, IndexSearcher searchable, Weight weight,
-        Filter filter, int nDocs, FieldDocSortedHitQueue hq, Sort sort, int i, int[] starts)
{
+        Filter filter, int nDocs, FieldDocSortedHitQueue hq, Sort sort, int docBase) {
       this.lock = lock;
       this.searchable = searchable;
       this.weight = weight;
       this.filter = filter;
       this.nDocs = nDocs;
       this.hq = hq;
-      this.i = i;
-      this.starts = starts;
+      this.docBase = docBase;
       this.sort = sort;
     }
 
@@ -700,7 +696,7 @@ public class IndexSearcher {
           // iterate over the score docs and change their fields value
           for (int j2 = 0; j2 < docs.scoreDocs.length; j2++) {
             FieldDoc fd = (FieldDoc) docs.scoreDocs[j2];
-            fd.fields[j] = Integer.valueOf(((Integer) fd.fields[j]).intValue() + starts[i]);
+            fd.fields[j] = Integer.valueOf(((Integer) fd.fields[j]).intValue() + docBase);
           }
           break;
         }
@@ -716,7 +712,7 @@ public class IndexSearcher {
       final ScoreDoc[] scoreDocs = docs.scoreDocs;
       for (int j = 0; j < scoreDocs.length; j++) { // merge scoreDocs into hq
         final FieldDoc fieldDoc = (FieldDoc) scoreDocs[j];
-        fieldDoc.doc += starts[i]; // convert doc 
+        fieldDoc.doc += docBase; // convert doc 
         //it would be so nice if we had a thread-safe insert 
         lock.lock();
         try {



Mime
View raw message