fix distrib search assumption about single-segment multireaders

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@794829 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2009-07-16 20:24:23 +00:00
parent f89c2d9a29
commit 4df62ab249
1 changed files with 7 additions and 2 deletions

View File

@ -191,7 +191,12 @@ public class QueryComponent extends SearchComponent
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 @@ public class QueryComponent extends SearchComponent
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;