Fix term counters in script field terms facet

Fixes #2878
This commit is contained in:
Igor Motov 2013-04-09 12:42:35 -04:00
parent ae74a8dbb7
commit b0e44a2b40
2 changed files with 5 additions and 1 deletions

View File

@ -182,7 +182,7 @@ public class ScriptTermsStringFieldFacetExecutor extends FacetExecutor {
@Override
public void postCollection() {
ScriptTermsStringFieldFacetExecutor.this.missing = missing;
ScriptTermsStringFieldFacetExecutor.this.total = missing;
ScriptTermsStringFieldFacetExecutor.this.total = total;
}
private boolean match(String value) {

View File

@ -1297,11 +1297,15 @@ public class SimpleFacetsTests extends AbstractNodesTests {
facet = searchResponse.getFacets().facet("facet1");
assertThat(facet.getName(), equalTo("facet1"));
assertThat(facet.getTotalCount(), equalTo(2l));
assertThat(facet.getOtherCount(), equalTo(0l));
assertThat(facet.getEntries().size(), equalTo(1));
assertThat(facet.getEntries().get(0).getTerm().string(), equalTo("111"));
assertThat(facet.getEntries().get(0).getCount(), equalTo(2));
facet = searchResponse.getFacets().facet("facet2");
assertThat(facet.getTotalCount(), equalTo(4l));
assertThat(facet.getOtherCount(), equalTo(0l));
assertThat(facet.getName(), equalTo("facet2"));
assertThat(facet.getEntries().size(), equalTo(3));
assertThat(facet.getEntries().get(0).getTerm().string(), equalTo("yyy"));