当前位置: 首页>>代码示例>>Java>>正文


Java QueryResponse.getResponse方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:SOLRAdminClient.java

示例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);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:14,代码来源:AnalyticsMergeStrategyTest.java

示例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.");
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:DistributedSpellCheckComponentTest.java

示例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");
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:DistributedSuggestComponentTest.java


注:本文中的org.apache.solr.client.solrj.response.QueryResponse.getResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。