DATAES-127 - Include total, other and missing count in TermResult

Include totalCount, otherCount and missingCount from TermsFacet in TermResult.
This commit is contained in:
Matija Obreza
2014-09-01 16:24:52 +02:00
committed by Artur Konczak
parent e80ddd249f
commit c9ffc4417a
3 changed files with 98 additions and 2 deletions

View File

@@ -56,7 +56,7 @@ public class DefaultFacetMapper {
for (TermsFacet.Entry entry : facet.getEntries()) {
entries.add(new Term(entry.getTerm().toString(), entry.getCount()));
}
return new TermResult(facet.getName(), entries);
return new TermResult(facet.getName(), entries, facet.getTotalCount(), facet.getOtherCount(), facet.getMissingCount());
}
private static FacetResult parseRange(RangeFacet facet) {

View File

@@ -27,17 +27,36 @@ import org.springframework.data.elasticsearch.core.facet.FacetType;
* @author Mohsin Husen
* @author Artur Konczak
* @author Jonathan Yan
* @author Matija Obreza
*/
public class TermResult extends AbstractFacetResult {
private List<Term> terms;
private long total;
private long other;
private long missing;
public TermResult(String name, List<Term> terms) {
public TermResult(String name, List<Term> terms, long total, long other, long missing) {
super(name, FacetType.term);
this.terms = terms;
this.total = total;
this.other = other;
this.missing = missing;
}
public List<Term> getTerms() {
return terms;
}
public long getTotal() {
return total;
}
public long getOther() {
return other;
}
public long getMissing() {
return missing;
}
}