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


Java Explanation.getDetails方法代码示例

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


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

示例1: buildExplanation

import org.apache.lucene.search.Explanation; //导入方法依赖的package包/类
private void buildExplanation(XContentBuilder builder, Explanation explanation) throws IOException {
    builder.startObject();
    builder.field(Fields.VALUE, explanation.getValue());
    builder.field(Fields.DESCRIPTION, explanation.getDescription());
    Explanation[] innerExps = explanation.getDetails();
    if (innerExps != null) {
        builder.startArray(Fields.DETAILS);
        for (Explanation exp : innerExps) {
            buildExplanation(builder, exp);
        }
        builder.endArray();
    }
    builder.endObject();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:SearchHit.java

示例2: writeExplanation

import org.apache.lucene.search.Explanation; //导入方法依赖的package包/类
public static void writeExplanation(StreamOutput out, Explanation explanation) throws IOException {
    out.writeBoolean(explanation.isMatch());
    out.writeString(explanation.getDescription());
    Explanation[] subExplanations = explanation.getDetails();
    out.writeVInt(subExplanations.length);
    for (Explanation subExp : subExplanations) {
        writeExplanation(out, subExp);
    }
    if (explanation.isMatch()) {
        out.writeFloat(explanation.getValue());
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:Lucene.java

示例3: 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

示例4: checkFiltersFunctionScoreExplanation

import org.apache.lucene.search.Explanation; //导入方法依赖的package包/类
public void checkFiltersFunctionScoreExplanation(Explanation randomExplanation, String functionExpl, int whichFunction) {
    assertThat(randomExplanation.getDescription(), equalTo("min of:"));
    Explanation explanation = randomExplanation.getDetails()[0];
    assertThat(explanation.getDescription(), equalTo("function score, score mode [avg]"));
    Explanation functionExplanation = randomExplanation.getDetails()[0].getDetails()[whichFunction];
    assertThat(functionExplanation.getDescription(), equalTo("function score, product of:"));
    assertThat(functionExplanation.getDetails()[0].getDescription(), equalTo("match filter: " + FIELD + ":" + TERM.text()));
    assertThat(functionExplanation.getDetails()[1].getDescription(), equalTo(functionExpl));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:FunctionScoreTests.java

示例5: getFunctionScoreExplanation

import org.apache.lucene.search.Explanation; //导入方法依赖的package包/类
public Explanation getFunctionScoreExplanation(IndexSearcher searcher, ScoreFunction scoreFunction) throws IOException {
    FunctionScoreQuery functionScoreQuery = new FunctionScoreQuery(new TermQuery(TERM), scoreFunction, 0.0f, CombineFunction.AVG, 100);
    Weight weight = searcher.createNormalizedWeight(functionScoreQuery, true);
    Explanation explanation = weight.explain(searcher.getIndexReader().leaves().get(0), 0);
    return explanation.getDetails()[1];
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:FunctionScoreTests.java


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