mirror of https://github.com/apache/lucene.git
SOLR-1202: fix facet.mincount distributed facet when sorted=index
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@781801 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0334f5e447
commit
7dab6190e8
|
@ -369,7 +369,8 @@ public class FacetComponent extends SearchComponent
|
|||
facet_fields.add(dff.getKey(), fieldCounts);
|
||||
|
||||
ShardFacetCount[] counts;
|
||||
if (dff.sort.equals(FacetParams.FACET_SORT_COUNT)) {
|
||||
boolean countSorted = dff.sort.equals(FacetParams.FACET_SORT_COUNT);
|
||||
if (countSorted) {
|
||||
counts = dff.countSorted;
|
||||
if (counts == null || dff.needRefinements) {
|
||||
counts = dff.getCountSorted();
|
||||
|
@ -382,7 +383,10 @@ public class FacetComponent extends SearchComponent
|
|||
|
||||
int end = dff.limit < 0 ? counts.length : Math.min(dff.offset + dff.limit, counts.length);
|
||||
for (int i=dff.offset; i<end; i++) {
|
||||
if (counts[i].count < dff.minCount) break;
|
||||
if (counts[i].count < dff.minCount) {
|
||||
if (countSorted) break; // if sorted by count, we can break out of loop early
|
||||
else continue;
|
||||
}
|
||||
fieldCounts.add(counts[i].name, num(counts[i].count));
|
||||
}
|
||||
|
||||
|
|
|
@ -543,7 +543,9 @@ public class TestDistributedSearch extends TestCase {
|
|||
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field",t1);
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field",t1, "facet.limit",-1, "facet.sort","count");
|
||||
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.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);
|
||||
|
|
Loading…
Reference in New Issue