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


Java SolrDocumentList.getMaxScore方法代码示例

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


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

示例1: createSolrResultPage

import org.apache.solr.common.SolrDocumentList; //导入方法依赖的package包/类
private <T> SolrResultPage<T> createSolrResultPage(Query query, Class<T> clazz, QueryResponse response,
		Map<String, Object> objectsName) {
	List<T> beans = convertQueryResponseToBeans(response, clazz);
	SolrDocumentList results = response.getResults();
	long numFound = results == null ? 0 : results.getNumFound();
	Float maxScore = results == null ? null : results.getMaxScore();

	Pageable pageRequest = query.getPageRequest();

	SolrResultPage<T> page = new SolrResultPage<T>(beans, pageRequest, numFound, maxScore);

	page.setFieldStatsResults(ResultHelper.convertFieldStatsInfoToFieldStatsResultMap(response.getFieldStatsInfo()));
	page.setGroupResults(ResultHelper.convertGroupQueryResponseToGroupResultMap(query, objectsName, response, this,
			clazz));

	return page;
}
 
开发者ID:yiduwangkai,项目名称:dubbox-solr,代码行数:18,代码来源:SolrTemplate.java

示例2: compare

import org.apache.solr.common.SolrDocumentList; //导入方法依赖的package包/类
public static String compare(SolrDocumentList a, SolrDocumentList b, int flags, Map<String, Integer> handle) {
  boolean ordered = (flags & UNORDERED) == 0;

  String cmp;
  int f = flags(handle, "maxScore");
  if ((f & SKIPVAL) == 0) {
    cmp = compare(a.getMaxScore(), b.getMaxScore(), 0, handle);
    if (cmp != null) return ".maxScore" + cmp;
  } else {
    if (b.getMaxScore() != null) {
      if (a.getMaxScore() == null) {
        return ".maxScore missing";
      }
    }
  }

  cmp = compare(a.getNumFound(), b.getNumFound(), 0, handle);
  if (cmp != null) return ".numFound" + cmp;

  cmp = compare(a.getStart(), b.getStart(), 0, handle);
  if (cmp != null) return ".start" + cmp;

  cmp = compare(a.size(), b.size(), 0, handle);
  if (cmp != null) return ".size()" + cmp;

  // only for completely ordered results (ties might be in a different order)
  if (ordered) {
    for (int i = 0; i < a.size(); i++) {
      cmp = compare(a.get(i), b.get(i), 0, handle);
      if (cmp != null) return "[" + i + "]" + cmp;
    }
    return null;
  }

  // unordered case
  for (int i = 0; i < a.size(); i++) {
    SolrDocument doc = a.get(i);
    Object key = doc.getFirstValue("id");
    SolrDocument docb = null;
    if (key == null) {
      // no id field to correlate... must compare ordered
      docb = b.get(i);
    } else {
      for (int j = 0; j < b.size(); j++) {
        docb = b.get(j);
        if (key.equals(docb.getFirstValue("id"))) break;
      }
    }
    // if (docb == null) return "[id="+key+"]";
    cmp = compare(doc, docb, 0, handle);
    if (cmp != null) return "[id=" + key + "]" + cmp;
  }
  return null;
}
 
开发者ID:europeana,项目名称:search,代码行数:55,代码来源:BaseDistributedSearchTestCase.java


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