本文整理汇总了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();
}
示例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());
}
}
示例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;
}
}
示例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));
}
示例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];
}