params.add(TermsParams.TERMS_FIELD, "lowerfilt");
params.add(TermsParams.TERMS_LOWER, "a");
params.add(TermsParams.TERMS_UPPER, "b");
params.add(TermsParams.TERMS_LIMIT, String.valueOf(50));
SolrRequestHandler handler;
SolrQueryResponse rsp;
NamedList values;
NamedList terms;
handler = core.getRequestHandler("/terms");
assertTrue("handler is null and it shouldn't be", handler != null);
rsp = new SolrQueryResponse();
rsp.add("responseHeader", new SimpleOrderedMap());
handler.handleRequest(new LocalSolrQueryRequest(core, params), rsp);
values = rsp.getValues();
terms = (NamedList) ((NamedList) values.get("terms")).get("lowerfilt");
assertTrue("terms Size: " + terms.size() + " is not: " + 5, terms.size() == 5);
assertTrue("aa is null and it shouldn't be", terms.get("aa") != null);
assertTrue("ab is null and it shouldn't be", terms.get("ab") != null);
assertTrue("aaa is null and it shouldn't be", terms.get("aaa") != null);
assertTrue("abb is null and it shouldn't be", terms.get("abb") != null);
assertTrue("abc is null and it shouldn't be", terms.get("abc") != null);
assertTrue("a is not null", terms.get("a") == null);
assertTrue("baa is not null", terms.get("baa") == null);
//test where the lower is not a term
params = new ModifiableSolrParams();
params.add(TermsParams.TERMS, "true");
params.add(TermsParams.TERMS_LOWER_INCLUSIVE, "false");
params.add(TermsParams.TERMS_FIELD, "standardfilt");
params.add(TermsParams.TERMS_LOWER, "cc");
params.add(TermsParams.TERMS_UPPER, "d");
params.add(TermsParams.TERMS_LIMIT, String.valueOf(50));
rsp = new SolrQueryResponse();
rsp.add("responseHeader", new SimpleOrderedMap());
handler.handleRequest(new LocalSolrQueryRequest(core, params), rsp);
values = rsp.getValues();
terms = (NamedList) ((NamedList) values.get("terms")).get("standardfilt");
assertTrue("terms Size: " + terms.size() + " is not: " + 2, terms.size() == 2);
}