lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r794829 - /lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java
Date Thu, 16 Jul 2009 20:24:23 GMT
Author: yonik
Date: Thu Jul 16 20:24:23 2009
New Revision: 794829

URL: http://svn.apache.org/viewvc?rev=794829&view=rev
Log:
fix distrib search assumption about single-segment multireaders

Modified:
    lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java

Modified: lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java?rev=794829&r1=794828&r2=794829&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/component/QueryComponent.java Thu Jul
16 20:24:23 2009
@@ -191,7 +191,12 @@
 
       SolrIndexReader reader = searcher.getReader();
       SolrIndexReader[] readers = reader.getLeafReaders();
-      if (readers.length==1) readers=null;
+      SolrIndexReader subReader = reader;
+      if (readers.length==1) {
+        // if there is a single segment, use that subReader and avoid looking up each time
+        subReader = readers[0];
+        readers=null;
+      }
       int[] offsets = reader.getLeafOffsets();
 
       for (SortField sortField: sortFields) {
@@ -207,7 +212,7 @@
         DocList docList = rb.getResults().docList;
         ArrayList<Object> vals = new ArrayList<Object>(docList.size());
         DocIterator it = rb.getResults().docList.iterator();
-        SolrIndexReader subReader = reader;
+
         int offset = 0;
         int idx = 0;
 



Mime
View raw message