SOLR-9193: fixing failing tests due to changes in TermsComponent

This commit is contained in:
jbernste 2016-07-04 22:32:51 -04:00
parent 879a245e4e
commit ed86e014f6
3 changed files with 7 additions and 5 deletions

View File

@ -67,6 +67,8 @@ public class TermsComponent extends SearchComponent {
SolrParams params = rb.req.getParams(); SolrParams params = rb.req.getParams();
if (params.getBool(TermsParams.TERMS, false)) { if (params.getBool(TermsParams.TERMS, false)) {
rb.doTerms = true; rb.doTerms = true;
} else {
return;
} }
// TODO: temporary... this should go in a different component. // TODO: temporary... this should go in a different component.
@ -97,7 +99,7 @@ public class TermsComponent extends SearchComponent {
if(termStats) { if(termStats) {
NamedList<Number> stats = new SimpleOrderedMap(); NamedList<Number> stats = new SimpleOrderedMap();
rb.rsp.add("stats", stats); rb.rsp.add("indexstats", stats);
collectStats(rb.req.getSearcher(), stats); collectStats(rb.req.getSearcher(), stats);
} }
@ -301,7 +303,7 @@ public class TermsComponent extends SearchComponent {
th.parse(terms); th.parse(terms);
NamedList<Number> stats = (NamedList<Number>)srsp.getSolrResponse().getResponse().get("stats"); NamedList<Number> stats = (NamedList<Number>)srsp.getSolrResponse().getResponse().get("indexstats");
if(stats != null) { if(stats != null) {
th.numDocs += stats.get("numDocs").longValue(); th.numDocs += stats.get("numDocs").longValue();
th.stats = true; th.stats = true;
@ -323,7 +325,7 @@ public class TermsComponent extends SearchComponent {
if(ti.stats) { if(ti.stats) {
NamedList<Number> stats = new SimpleOrderedMap(); NamedList<Number> stats = new SimpleOrderedMap();
stats.add("numDocs", Long.valueOf(ti.numDocs)); stats.add("numDocs", Long.valueOf(ti.numDocs));
rb.rsp.add("stats", stats); rb.rsp.add("indexstats", stats);
} }
rb._termsHelper = null; rb._termsHelper = null;
} }

View File

@ -198,7 +198,7 @@ public class TermsComponentTest extends SolrTestCaseJ4 {
assertQ(req("indent", "true", "qt", "/terms", "terms", "true", assertQ(req("indent", "true", "qt", "/terms", "terms", "true",
"terms.fl", "standardfilt","terms.stats", "true", "terms.fl", "standardfilt","terms.stats", "true",
"terms.list", "spider, snake, shark, ddddd, bad") "terms.list", "spider, snake, shark, ddddd, bad")
, "//lst[@name='stats']/int[1][@name='numDocs'][.='23']" , "//lst[@name='indexstats']/long[1][@name='numDocs'][.='23']"
); );
} }

View File

@ -189,7 +189,7 @@ public class ScoreNodesStream extends TupleStream implements Expressible
//Get the response from the terms component //Get the response from the terms component
NamedList response = client.request(request, collection); NamedList response = client.request(request, collection);
NamedList<Number> stats = (NamedList<Number>)response.get("stats"); NamedList<Number> stats = (NamedList<Number>)response.get("indexstats");
long numDocs = stats.get("numDocs").longValue(); long numDocs = stats.get("numDocs").longValue();
NamedList<NamedList<Number>> fields = (NamedList<NamedList<Number>>)response.get("terms"); NamedList<NamedList<Number>> fields = (NamedList<NamedList<Number>>)response.get("terms");