diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index dca1dd264a3..dcd102fc54d 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -369,6 +369,12 @@ Bug Fixes prior to the float value. (Markus Jelsma, hossman) +* SOLR-2662: When Solr is configured to have no queryResultCache, the + "start" parameter was not honored and the documents returned were + 0 through start+offset. (Markus Jelsma, yonik) + + + 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.java index 513fcab7b09..c60eaeb8f86 100644 --- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java +++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java @@ -1151,10 +1151,9 @@ public class SolrIndexSearcher extends IndexSearcher implements SolrInfoMBean { getDocListNC(qr,cmd); //Parameters: cmd.getQuery(),theFilt,cmd.getSort(),0,supersetMaxDoc,cmd.getFlags(),cmd.getTimeAllowed(),responseHeader); } - if (key != null) { - superset = out.docList; - out.docList = superset.subset(cmd.getOffset(),cmd.getLen()); - } + + superset = out.docList; + out.docList = superset.subset(cmd.getOffset(),cmd.getLen()); } // lastly, put the superset in the cache if the size is less than or equal diff --git a/solr/core/src/test/org/apache/solr/search/TestFiltering.java b/solr/core/src/test/org/apache/solr/search/TestFiltering.java index da23d148c6e..f9c3b310c18 100644 --- a/solr/core/src/test/org/apache/solr/search/TestFiltering.java +++ b/solr/core/src/test/org/apache/solr/search/TestFiltering.java @@ -101,6 +101,10 @@ public class TestFiltering extends SolrTestCaseJ4 { ); assertEquals(0, DelegatingCollector.setLastDelegateCount - prevCount); + // test that offset works when not caching main query + assertJQ(req("q","{!cache=false}*:*", "start","2", "rows","1", "sort","val_i asc", "fl","val_i") + ,"/response/docs==[{'val_i':3}]" + ); }