Remove Infinity values for Range facets when no docs match the range, closes #1366.

This commit is contained in:
Shay Banon 2011-09-27 00:41:57 +03:00
parent 737589f50d
commit 0c82fc5901
1 changed files with 5 additions and 2 deletions

View File

@ -180,8 +180,11 @@ public class InternalRangeFacet implements RangeFacet, InternalFacet {
builder.field(Fields.TO_STR, entry.toAsString);
}
builder.field(Fields.COUNT, entry.count());
builder.field(Fields.MIN, entry.min());
builder.field(Fields.MAX, entry.max());
// only output min and max if there are actually documents matching this range...
if (entry.totalCount() > 0) {
builder.field(Fields.MIN, entry.min());
builder.field(Fields.MAX, entry.max());
}
builder.field(Fields.TOTAL_COUNT, entry.totalCount());
builder.field(Fields.TOTAL, entry.total());
builder.field(Fields.MEAN, entry.mean());