diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 5bb242de949..eaf2a2e1418 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -693,6 +693,10 @@ Bug Fixes useful error reporting when no match found (previously failed with a NullPointerException in log and no clear user feedback). (gthb via yonik) +* SOLR-2380: Distributed faceting could miss values when facet.sort=index + and when facet.offset was greater than 0. (yonik) + + Other Changes ---------------------- diff --git a/solr/src/java/org/apache/solr/handler/component/FacetComponent.java b/solr/src/java/org/apache/solr/handler/component/FacetComponent.java index 0bbeaff45f2..f2f48b0b37c 100644 --- a/solr/src/java/org/apache/solr/handler/component/FacetComponent.java +++ b/solr/src/java/org/apache/solr/handler/component/FacetComponent.java @@ -222,12 +222,11 @@ public class FacetComponent extends SearchComponent sreq.params.remove(paramStart + FacetParams.FACET_MINCOUNT); sreq.params.remove(paramStart + FacetParams.FACET_OFFSET); + dff.initialLimit = dff.offset + dff.limit; + if(dff.sort.equals(FacetParams.FACET_SORT_COUNT) && dff.limit > 0) { // set the initial limit higher to increase accuracy - dff.initialLimit = dff.offset + dff.limit; dff.initialLimit = (int)(dff.initialLimit * 1.5) + 10; - } else { - dff.initialLimit = dff.limit; } // Currently this is for testing only and allows overriding of the diff --git a/solr/src/test/org/apache/solr/TestDistributedSearch.java b/solr/src/test/org/apache/solr/TestDistributedSearch.java index 5151564fedd..746229e05d4 100755 --- a/solr/src/test/org/apache/solr/TestDistributedSearch.java +++ b/solr/src/test/org/apache/solr/TestDistributedSearch.java @@ -137,6 +137,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase { query("q","*:*", "rows",100, "facet","true", "facet.field",t1, "facet.limit",-1, "facet.sort","count", "facet.mincount",2); query("q","*:*", "rows",100, "facet","true", "facet.field",t1, "facet.limit",-1, "facet.sort","index"); query("q","*:*", "rows",100, "facet","true", "facet.field",t1, "facet.limit",-1, "facet.sort","index", "facet.mincount",2); + query("q","*:*", "rows",100, "facet","true", "facet.field",t1, "facet.offset",10, "facet.limit",1, "facet.sort","index"); query("q","*:*", "rows",100, "facet","true", "facet.field",t1,"facet.limit",1); query("q","*:*", "rows",100, "facet","true", "facet.query","quick", "facet.query","all", "facet.query","*:*"); query("q","*:*", "rows",100, "facet","true", "facet.field",t1, "facet.offset",1);