本文整理匯總了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;
}
示例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;
}