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


Java Explanation.getValue方法代码示例

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


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

示例1: explain

import org.apache.lucene.search.Explanation; //导入方法依赖的package包/类
@Override
public Explanation explain(LeafReaderContext context, int doc) throws IOException {
    Explanation subQueryExpl = subQueryWeight.explain(context, doc);
    if (!subQueryExpl.isMatch()) {
        return subQueryExpl;
    }
    Explanation expl;
    if (function != null) {
        Explanation functionExplanation = function.getLeafScoreFunction(context).explainScore(doc, subQueryExpl);
        expl = combineFunction.explain(subQueryExpl, functionExplanation, maxBoost);
    } else {
        expl = subQueryExpl;
    }
    if (minScore != null && minScore > expl.getValue()) {
        expl = Explanation.noMatch("Score value is too low, expected at least " + minScore + " but got " + expl.getValue(), expl);
    }
    return expl;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:FunctionScoreQuery.java

示例2: findPayloadBoostInExplanation

import org.apache.lucene.search.Explanation; //导入方法依赖的package包/类
boolean findPayloadBoostInExplanation(Explanation expl) {
    if (expl.getDescription().startsWith("payloadBoost=") && expl.getValue() != 1f) {
        return true;
    } else {
        boolean found = false;
        for (Explanation sub : expl.getDetails()) {
            found |= findPayloadBoostInExplanation(sub);
        }
        return found;
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:OldIndexBackwardsCompatibilityIT.java

示例3: explainScore

import org.apache.lucene.search.Explanation; //导入方法依赖的package包/类
private Explanation explainScore(int doc, Explanation freq, BM25Stats stats, NumericDocValues norms) {
  Explanation result = new Explanation();
  result.setDescription("score(doc="+doc+",freq="+freq+"), product of:");
  
  Explanation boostExpl = new Explanation(stats.queryBoost * stats.topLevelBoost, "boost");
  if (boostExpl.getValue() != 1.0f)
    result.addDetail(boostExpl);
  
  result.addDetail(stats.idf);

  Explanation tfNormExpl = new Explanation();
  tfNormExpl.setDescription("tfNorm, computed from:");
  tfNormExpl.addDetail(freq);
  tfNormExpl.addDetail(new Explanation(k1, "parameter k1"));
  if (norms == null) {
    tfNormExpl.addDetail(new Explanation(0, "parameter b (norms omitted for field)"));
    tfNormExpl.setValue((freq.getValue() * (k1 + 1)) / (freq.getValue() + k1));
  } else {
    float doclen = decodeNormValue((byte)norms.get(doc));
    tfNormExpl.addDetail(new Explanation(b, "parameter b"));
    tfNormExpl.addDetail(new Explanation(stats.avgdl, "avgFieldLength"));
    tfNormExpl.addDetail(new Explanation(doclen, "fieldLength"));
    tfNormExpl.setValue((freq.getValue() * (k1 + 1)) / (freq.getValue() + k1 * (1 - b + b * doclen/stats.avgdl)));
  }
  result.addDetail(tfNormExpl);
  result.setValue(boostExpl.getValue() * stats.idf.getValue() * tfNormExpl.getValue());
  return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:BM25Similarity.java

示例4: explain

import org.apache.lucene.search.Explanation; //导入方法依赖的package包/类
/**
 * Explain the score for a single document
 * @param doc document id within the inverted index segment
 * @param freq Explanation of how the sloppy term frequency was computed
 * @return document's score
 */
public Explanation explain(int doc, Explanation freq) {
  Explanation result = new Explanation(score(doc, freq.getValue()), 
      "score(doc=" + doc + ",freq=" + freq.getValue() +"), with freq of:");
  result.addDetail(freq);
  return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:Similarity.java

示例5: explain

import org.apache.lucene.search.Explanation; //导入方法依赖的package包/类
@Override
protected void explain(Explanation expl,
    BasicStats stats, int doc, float freq, float docLen) {
  if (stats.getTotalBoost() != 1.0f) {
    expl.addDetail(new Explanation(stats.getTotalBoost(), "boost"));
  }
  
  Explanation normExpl = normalization.explain(stats, freq, docLen);
  float tfn = normExpl.getValue();
  expl.addDetail(normExpl);
  expl.addDetail(basicModel.explain(stats, tfn));
  expl.addDetail(afterEffect.explain(stats, tfn));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:DFRSimilarity.java

示例6: IDFStats

import org.apache.lucene.search.Explanation; //导入方法依赖的package包/类
public IDFStats(String field, Explanation idf, float queryBoost) {
  // TODO: Validate?
  this.field = field;
  this.idf = idf;
  this.queryBoost = queryBoost;
  this.queryWeight = idf.getValue() * queryBoost; // compute query weight
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:TFIDFSimilarity.java

示例7: explainScore

import org.apache.lucene.search.Explanation; //导入方法依赖的package包/类
private Explanation explainScore(int doc, Explanation freq, BM25StatsFixed stats, NumericDocValues norms) {
  Explanation boostExpl = Explanation.match(stats.boost, "boost");
  List<Explanation> subs = new ArrayList<>();
  if (boostExpl.getValue() != 1.0f)
    subs.add(boostExpl);
  subs.add(stats.idf);
  Explanation tfNormExpl = explainTFNorm(doc, freq, stats, norms);
  subs.add(tfNormExpl);
  return Explanation.match(
      boostExpl.getValue() * stats.idf.getValue() * tfNormExpl.getValue(),
      "score(doc="+doc+",freq="+freq+"), product of:", subs);
}
 
开发者ID:sebastian-hofstaetter,项目名称:ir-generalized-translation-models,代码行数:13,代码来源:BM25SimilarityLossless.java

示例8: explainScore

import org.apache.lucene.search.Explanation; //导入方法依赖的package包/类
private Explanation explainScore(int doc, Explanation freq, IDFStats stats, NumericDocValues norms) {
  Explanation result = new Explanation();
  result.setDescription("score(doc="+doc+",freq="+freq+"), product of:");

  // explain query weight
  Explanation queryExpl = new Explanation();
  queryExpl.setDescription("queryWeight, product of:");

  Explanation boostExpl = new Explanation(stats.queryBoost, "boost");
  if (stats.queryBoost != 1.0f)
    queryExpl.addDetail(boostExpl);
  queryExpl.addDetail(stats.idf);

  Explanation queryNormExpl = new Explanation(stats.queryNorm,"queryNorm");
  queryExpl.addDetail(queryNormExpl);

  queryExpl.setValue(boostExpl.getValue() *
                     stats.idf.getValue() *
                     queryNormExpl.getValue());

  result.addDetail(queryExpl);

  // explain field weight
  Explanation fieldExpl = new Explanation();
  fieldExpl.setDescription("fieldWeight in "+doc+
                           ", product of:");

  Explanation tfExplanation = new Explanation();
  tfExplanation.setValue(tf(freq.getValue()));
  tfExplanation.setDescription("tf(freq="+freq.getValue()+"), with freq of:");
  tfExplanation.addDetail(freq);
  fieldExpl.addDetail(tfExplanation);
  fieldExpl.addDetail(stats.idf);

  Explanation fieldNormExpl = new Explanation();
  float fieldNorm = norms != null ? decodeNormValue(norms.get(doc)) : 1.0f;
  fieldNormExpl.setValue(fieldNorm);
  fieldNormExpl.setDescription("fieldNorm(doc="+doc+")");
  fieldExpl.addDetail(fieldNormExpl);
  
  fieldExpl.setValue(tfExplanation.getValue() *
                     stats.idf.getValue() *
                     fieldNormExpl.getValue());

  result.addDetail(fieldExpl);
  
  // combine them
  result.setValue(queryExpl.getValue() * fieldExpl.getValue());

  if (queryExpl.getValue() == 1.0f)
    return fieldExpl;

  return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:55,代码来源:TFIDFSimilarity.java


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