Skip to content

Commit aa6a5e3

Browse files
committed
DATAES-10 added 3 additional properties to Range Facet
1 parent 839d4f3 commit aa6a5e3

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/main/java/org/springframework/data/elasticsearch/core/facet/FacetMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private static FacetResult parseTerm(TermsFacet facet) {
3939
private static FacetResult parseRange(RangeFacet facet) {
4040
List<Range> entries = new ArrayList<Range>();
4141
for (RangeFacet.Entry entry : facet.getEntries()) {
42-
entries.add(new Range(entry.getFrom() == Double.NEGATIVE_INFINITY ? null : entry.getFrom(), entry.getTo() == Double.POSITIVE_INFINITY ? null : entry.getTo(), entry.getCount(), entry.getTotal()));
42+
entries.add(new Range(entry.getFrom() == Double.NEGATIVE_INFINITY ? null : entry.getFrom(), entry.getTo() == Double.POSITIVE_INFINITY ? null : entry.getTo(), entry.getCount(), entry.getTotal(), entry.getTotalCount(), entry.getMin(), entry.getMax()));
4343
}
4444
return new RangeResult(facet.getName(), entries);
4545
}

src/main/java/org/springframework/data/elasticsearch/core/facet/result/Range.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@ public class Range {
1414
private Double to;
1515
private long count;
1616
private double total;
17+
private double totalCount;
18+
private double min = Double.POSITIVE_INFINITY;
19+
private double max = Double.NEGATIVE_INFINITY;
1720

18-
19-
public Range(Double from, Double to, long count, double total) {
21+
public Range(Double from, Double to, long count, double total, double totalCount, double min, double max) {
2022
this.from = from;
2123
this.to = to;
2224
this.count = count;
2325
this.total = total;
26+
this.totalCount = totalCount;
27+
this.min = min;
28+
this.max = max;
2429
}
2530

2631
public Double getFrom() {
@@ -43,4 +48,16 @@ public long getCount() {
4348
public double getTotal() {
4449
return total;
4550
}
51+
52+
public double getTotalCount() {
53+
return totalCount;
54+
}
55+
56+
public double getMin() {
57+
return min;
58+
}
59+
60+
public double getMax() {
61+
return max;
62+
}
4663
}

0 commit comments

Comments
 (0)