當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。