Fixed Interval Facet count issue in cases of open/close intervals on the same values

This commit is contained in:
Tomas Fernandez Lobbe 2016-10-24 19:49:54 -07:00
parent c9132ac661
commit ce57e8a8f4
3 changed files with 21 additions and 3 deletions

View File

@ -208,6 +208,9 @@ Bug Fixes
* SOLR-9518: Kerberos Delegation Tokens don't work without a chrooted ZK (Ishan Chattopadhyaya,via noble)
* SOLR-9687: Fixed Interval Facet count issue in cases of open/close intervals on the same values
(Andy Chillrud, Tomás Fernández Löbbe)
Optimizations
----------------------
@ -3290,7 +3293,7 @@ Bug Fixes
while accessing other collections. (Shai Erera)
* SOLR-7412: Fixed range.facet.other parameter for distributed requests.
(Will Miller, Tomás Fernándes Löbbe)
(Will Miller, Tomás Fernández Löbbe)
* SOLR-6087: SolrIndexSearcher makes no DelegatingCollector.finish() call when IndexSearcher
throws an expected exception. (Christine Poerschke via shalin)

View File

@ -157,7 +157,17 @@ public class IntervalFacets implements Iterable<FacetInterval> {
if (o2.start == null) {
return 1;
}
return o1.start.compareTo(o2.start);
int startComparison = o1.start.compareTo(o2.start);
if (startComparison == 0) {
if (o1.startOpen != o2.startOpen) {
if (!o1.startOpen) {
return -1;
} else {
return 1;
}
}
}
return startComparison;
}
});
return sortedIntervals;

View File

@ -943,6 +943,9 @@ public class TestIntervalFaceting extends SolrTestCaseJ4 {
assertIntervalQuery(field, "(0,2]", "2");
assertIntervalQuery(field, "[*,5]", "6");
assertIntervalQuery(field, "[*,3)", "3", "[2,5)", "3", "[6,8)", "2", "[3,*]", "7", "[10,10]", "1", "[10,10]", "1", "[10,10]", "1");
assertIntervalQuery(field, "(5,*]", "4", "[5,5]", "1", "(*,5)", "5");
assertIntervalQuery(field, "[5,5]", "1", "(*,5)", "5", "(5,*]", "4");
assertIntervalQuery(field, "(5,*]", "4", "(*,5)", "5", "[5,5]", "1");
}
@ -955,7 +958,9 @@ public class TestIntervalFaceting extends SolrTestCaseJ4 {
assertIntervalQuery(field, "[*,bird)", "2", "[bird,cat)", "1", "[cat,dog)", "2", "[dog,*]", "4");
assertIntervalQuery(field, "[*,*]", "9", "[*,dog)", "5", "[*,dog]", "8", "[dog,*]", "4");
assertIntervalQuery(field, field + ":dog", 3, "[*,*]", "3", "[*,dog)", "0", "[*,dog]", "3", "[dog,*]", "3", "[bird,cat]", "0");
assertIntervalQuery(field, "(*,dog)", "5", "[dog, dog]", "3", "(dog,*)", "1");
assertIntervalQuery(field, "[dog, dog]", "3", "(dog,*)", "1", "(*,dog)", "5");
assertIntervalQuery(field, "(dog,*)", "1", "(*,dog)", "5", "[dog, dog]", "3");
}
/**