Apache Lucene open-source search software
SOLR-2923: IllegalArgumentException when using useFilterForSortedQuery on an empty index.
Mark Robert Millera72fb4fb779e
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 6e9e54f3c21..5c596887417 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -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----------------------diff --git a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.javaindex b2ae0edfee6..3e2c37190fa 100644--- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java+++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java@@ -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);