SOLR-2380 fix facet.limit for distrib faceting and facet.sort=index

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1074326 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2011-02-24 22:29:35 +00:00
parent e315a4a311
commit b43011aef5
3 changed files with 7 additions and 3 deletions

View File

@ -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
----------------------

View File

@ -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

View File

@ -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);