SOLR-2923: IllegalArgumentException when using useFilterForSortedQuery on an empty index.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1342702 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-05-25 15:55:06 +00:00
parent 50baab7c4b
commit a72fb4fb77
2 changed files with 9 additions and 1 deletions

View File

@ -446,6 +446,9 @@ Bug Fixes
* LUCENE-4075: Cleaner path usage in TestXPathEntityProcessor
(Greg Bowyer via hossman)
* SOLR-2923: IllegalArgumentException when using useFilterForSortedQuery on an
empty index. (Adrien Grand via Mark Miller)
Other Changes
----------------------

View File

@ -1784,7 +1784,12 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable,SolrIn
}
protected DocList sortDocSet(DocSet set, Sort sort, int nDocs) throws IOException {
// bit of a hack to tell if a set is sorted - do it better in the futute.
if (nDocs == 0) {
// SOLR-2923
return new DocSlice(0, 0, new int[0], null, 0, 0f);
}
// bit of a hack to tell if a set is sorted - do it better in the future.
boolean inOrder = set instanceof BitDocSet || set instanceof SortedIntDocSet;
TopDocsCollector topCollector = TopFieldCollector.create(weightSort(sort), nDocs, false, false, false, inOrder);