本文整理汇总了Java中org.apache.solr.client.solrj.response.QueryResponse.getResponse方法的典型用法代码示例。如果您正苦于以下问题:Java QueryResponse.getResponse方法的具体用法?Java QueryResponse.getResponse怎么用?Java QueryResponse.getResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.client.solrj.response.QueryResponse
的用法示例。
在下文中一共展示了QueryResponse.getResponse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pingSolr
import org.apache.solr.client.solrj.response.QueryResponse; //导入方法依赖的package包/类
protected void pingSolr()
{
ModifiableSolrParams params = new ModifiableSolrParams();
params.set("qt", "/admin/cores");
params.set("action", "STATUS");
QueryResponse response = basicQuery(params);
if(response != null && response.getStatus() == 0)
{
NamedList<Object> results = response.getResponse();
@SuppressWarnings("unchecked")
NamedList<Object> report = (NamedList<Object>)results.get("status");
Iterator<Map.Entry<String, Object>> coreIterator = report.iterator();
List<String> cores = new ArrayList<String>(report.size());
while(coreIterator.hasNext())
{
Map.Entry<String, Object> core = coreIterator.next();
cores.add(core.getKey());
}
registerCores(cores);
setSolrActive(true);
}
else
{
setSolrActive(false);
}
}
示例2: assertCount
import org.apache.solr.client.solrj.response.QueryResponse; //导入方法依赖的package包/类
private void assertCount(QueryResponse rsp, int count) throws Exception {
NamedList response = rsp.getResponse();
NamedList analytics = (NamedList)response.get("analytics");
Integer c = (Integer)analytics.get("mycount");
if(c.intValue() != count) {
throw new Exception("Count is not correct:"+count+":"+c.intValue());
}
long numFound = rsp.getResults().getNumFound();
if(c.intValue() != numFound) {
throw new Exception("Count does not equal numFound:"+c.intValue()+":"+numFound);
}
}
示例3: validateControlData
import org.apache.solr.client.solrj.response.QueryResponse; //导入方法依赖的package包/类
@Override
public void validateControlData(QueryResponse control) throws Exception
{
NamedList<Object> nl = control.getResponse();
@SuppressWarnings("unchecked")
NamedList<Object> sc = (NamedList<Object>) nl.get("spellcheck");
@SuppressWarnings("unchecked")
NamedList<Object> sug = (NamedList<Object>) sc.get("suggestions");
if(sug.size()==0) {
Assert.fail("Control data did not return any suggestions.");
}
}
示例4: validateControlData
import org.apache.solr.client.solrj.response.QueryResponse; //导入方法依赖的package包/类
@Override
public void validateControlData(QueryResponse control) throws Exception
{
NamedList<Object> nl = control.getResponse();
@SuppressWarnings("unchecked")
Map<String, SimpleOrderedMap<NamedList<Object>>> sc = (Map<String, SimpleOrderedMap<NamedList<Object>>>) nl.get("suggest");
String command = (String) nl.get("command");
if(sc.size() == 0 && command == null) {
Assert.fail("Control data did not return any suggestions or execute any command");
}
}