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


Java SolrIndexSearcher.QueryResult方法代码示例

本文整理汇总了Java中org.apache.solr.search.SolrIndexSearcher.QueryResult方法的典型用法代码示例。如果您正苦于以下问题:Java SolrIndexSearcher.QueryResult方法的具体用法?Java SolrIndexSearcher.QueryResult怎么用?Java SolrIndexSearcher.QueryResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.search.SolrIndexSearcher的用法示例。


在下文中一共展示了SolrIndexSearcher.QueryResult方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processResult

import org.apache.solr.search.SolrIndexSearcher; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public NamedList processResult(SolrIndexSearcher.QueryResult queryResult, ShardResultTransformer transformer) throws IOException {
  if (docSet != null) {
    queryResult.setDocSet(docSet);
  }
  queryResult.setPartialResults(partialResults);
  return transformer.transform(commands);
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:CommandHandler.java

示例2: setResult

import org.apache.solr.search.SolrIndexSearcher; //导入方法依赖的package包/类
/**
 * Sets results from a SolrIndexSearcher.QueryResult.
 */
public void setResult(SolrIndexSearcher.QueryResult result) {
  setResults(result.getDocListAndSet());
  if (result.isPartialResults()) {
    rsp.getResponseHeader().add("partialResults", Boolean.TRUE);
  }
  if (null != cursorMark) {
    assert null != result.getNextCursorMark() : "using cursor but no next cursor set";
    this.setNextCursorMark(result.getNextCursorMark());
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:14,代码来源:ResponseBuilder.java

示例3: testDocListConversion

import org.apache.solr.search.SolrIndexSearcher; //导入方法依赖的package包/类
@Test
public void testDocListConversion() throws Exception {
  assertU("", adoc("id", "3234", "val_i", "1", 
                   "val_dynamic", "quick red fox"));
  assertU("", adoc("id", "3235", "val_i", "1", 
                   "val_dynamic", "quick green fox"));
  assertU("", adoc("id", "3236", "val_i", "1", 
                   "val_dynamic", "quick brown fox"));
  assertU("", commit());

  RefCounted<SolrIndexSearcher> holder = h.getCore().getSearcher();
  try {
    SolrIndexSearcher srchr = holder.get();
    SolrIndexSearcher.QueryResult qr = new SolrIndexSearcher.QueryResult();
    SolrIndexSearcher.QueryCommand cmd = new SolrIndexSearcher.QueryCommand();
    cmd.setQuery(new MatchAllDocsQuery());
    cmd.setLen(10);
    qr = srchr.search(qr, cmd);
    
    DocList docs = qr.getDocList();
    assertEquals("wrong docs size", 3, docs.size());
    Set<String> fields = new HashSet<>();
    fields.add("val_dynamic");
    fields.add("dynamic_val");
    fields.add("range_facet_l"); // copied from id
    
    SolrDocumentList list = SolrPluginUtils.docListToSolrDocumentList(docs, srchr, fields, null);
    assertEquals("wrong list Size", docs.size(), list.size());
    for (SolrDocument document : list) {
      
      assertTrue("unexpected field", ! document.containsKey("val_i"));
      assertTrue("unexpected id field", ! document.containsKey("id"));

      assertTrue("original field", document.containsKey("val_dynamic"));
      assertTrue("dyn copy field", document.containsKey("dynamic_val"));
      assertTrue("copy field", document.containsKey("range_facet_l"));
      
      assertNotNull("original field null", document.get("val_dynamic"));
      assertNotNull("dyn copy field null", document.get("dynamic_val"));
      assertNotNull("copy field null", document.get("range_facet_l"));
    }
  } finally {
    if (null != holder) holder.decref();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:46,代码来源:SolrPluginUtilsTest.java


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