org.apache.lucene.search.QueryRescorer.combine()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(79)

本文整理了Java中org.apache.lucene.search.QueryRescorer.combine方法的一些代码示例,展示了QueryRescorer.combine的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryRescorer.combine方法的具体详情如下:
包路径:org.apache.lucene.search.QueryRescorer
类名称:QueryRescorer
方法名:combine

QueryRescorer.combine介绍

[英]Implement this in a subclass to combine the first pass and second pass scores. If secondPassMatches is false then the second pass query failed to match a hit from the first pass query, and you should ignore the secondPassScore.
[中]在子类中实现这一点,以结合第一次通过和第二次通过的分数。如果secondPassMatches为false,则第二个pass查询无法匹配第一个pass查询的命中率,您应该忽略secondPassScore。

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

@Override
public Explanation explain(IndexSearcher searcher, Explanation firstPassExplanation, int docID) throws IOException {
 Explanation secondPassExplanation = searcher.explain(query, docID);
 Float secondPassScore = secondPassExplanation.isMatch() ? secondPassExplanation.getValue() : null;
 float score;
 if (secondPassScore == null) {
  score = combine(firstPassExplanation.getValue(), false, 0.0f);
 } else {
  score = combine(firstPassExplanation.getValue(), true,  secondPassScore.floatValue());
 }
 Explanation first = Explanation.match(firstPassExplanation.getValue(), "first pass score", firstPassExplanation);
 Explanation second;
 if (secondPassScore == null) {
  second = Explanation.noMatch("no second pass score");
 } else {
  second = Explanation.match(secondPassScore, "second pass score", secondPassExplanation);
 }
 return Explanation.match(score, "combined first and second pass score using " + getClass(), first, second);
}

代码示例来源:origin: org.apache.lucene/lucene-core

hit.score = combine(hit.score, true, scorer.score());
} else {
 hit.score = combine(hit.score, false, 0.0f);
hit.score = combine(hit.score, false, 0.0f);

代码示例来源:origin: harbby/presto-connectors

@Override
public Explanation explain(IndexSearcher searcher, Explanation firstPassExplanation, int docID) throws IOException {
 Explanation secondPassExplanation = searcher.explain(query, docID);
 Float secondPassScore = secondPassExplanation.isMatch() ? secondPassExplanation.getValue() : null;
 float score;
 if (secondPassScore == null) {
  score = combine(firstPassExplanation.getValue(), false, 0.0f);
 } else {
  score = combine(firstPassExplanation.getValue(), true,  secondPassScore.floatValue());
 }
 Explanation first = Explanation.match(firstPassExplanation.getValue(), "first pass score", firstPassExplanation);
 Explanation second;
 if (secondPassScore == null) {
  second = Explanation.noMatch("no second pass score");
 } else {
  second = Explanation.match(secondPassScore, "second pass score", secondPassExplanation);
 }
 return Explanation.match(score, "combined first and second pass score using " + getClass(), first, second);
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

@Override
public Explanation explain(IndexSearcher searcher, Explanation firstPassExplanation, int docID) throws IOException {
 Explanation secondPassExplanation = searcher.explain(query, docID);
 Float secondPassScore = secondPassExplanation.isMatch() ? secondPassExplanation.getValue() : null;
 float score;
 if (secondPassScore == null) {
  score = combine(firstPassExplanation.getValue(), false, 0.0f);
 } else {
  score = combine(firstPassExplanation.getValue(), true,  secondPassScore.floatValue());
 }
 Explanation first = Explanation.match(firstPassExplanation.getValue(), "first pass score", firstPassExplanation);
 Explanation second;
 if (secondPassScore == null) {
  second = Explanation.noMatch("no second pass score");
 } else {
  second = Explanation.match(secondPassScore, "second pass score", secondPassExplanation);
 }
 return Explanation.match(score, "combined first and second pass score using " + getClass(), first, second);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

@Override
public Explanation explain(IndexSearcher searcher, Explanation firstPassExplanation, int docID) throws IOException {
 Explanation secondPassExplanation = searcher.explain(query, docID);
 Float secondPassScore = secondPassExplanation.isMatch() ? secondPassExplanation.getValue() : null;
 float score;
 if (secondPassScore == null) {
  score = combine(firstPassExplanation.getValue(), false, 0.0f);
 } else {
  score = combine(firstPassExplanation.getValue(), true,  secondPassScore.floatValue());
 }
 Explanation first = Explanation.match(firstPassExplanation.getValue(), "first pass score", firstPassExplanation);
 Explanation second;
 if (secondPassScore == null) {
  second = Explanation.noMatch("no second pass score");
 } else {
  second = Explanation.match(secondPassScore, "second pass score", secondPassExplanation);
 }
 return Explanation.match(score, "combined first and second pass score using " + getClass(), first, second);
}

代码示例来源:origin: harbby/presto-connectors

hit.score = combine(hit.score, true, scorer.score());
} else {
 hit.score = combine(hit.score, false, 0.0f);
hit.score = combine(hit.score, false, 0.0f);

代码示例来源:origin: org.infinispan/infinispan-embedded-query

hit.score = combine(hit.score, true, scorer.score());
} else {
 hit.score = combine(hit.score, false, 0.0f);
hit.score = combine(hit.score, false, 0.0f);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

hit.score = combine(hit.score, true, scorer.score());
} else {
 hit.score = combine(hit.score, false, 0.0f);
hit.score = combine(hit.score, false, 0.0f);

相关文章

微信公众号

最新文章

更多

QueryRescorer类方法