本文整理汇总了Java中org.elasticsearch.common.lucene.search.function.CombineFunction.MULTIPLY属性的典型用法代码示例。如果您正苦于以下问题:Java CombineFunction.MULTIPLY属性的具体用法?Java CombineFunction.MULTIPLY怎么用?Java CombineFunction.MULTIPLY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.elasticsearch.common.lucene.search.function.CombineFunction
的用法示例。
在下文中一共展示了CombineFunction.MULTIPLY属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractDistanceScoreFunction
public AbstractDistanceScoreFunction(double userSuppiedScale, double decay, double offset, DecayFunction func,
MultiValueMode mode) {
super(CombineFunction.MULTIPLY);
this.mode = mode;
if (userSuppiedScale <= 0.0) {
throw new IllegalArgumentException(FunctionScoreQueryBuilder.NAME + " : scale must be > 0.0.");
}
if (decay <= 0.0 || decay >= 1.0) {
throw new IllegalArgumentException(FunctionScoreQueryBuilder.NAME + " : decay must be in the range [0..1].");
}
this.scale = func.processScale(userSuppiedScale, decay);
this.func = func;
if (offset < 0.0d) {
throw new IllegalArgumentException(FunctionScoreQueryBuilder.NAME + " : offset must be > 0.0");
}
this.offset = offset;
}
示例2: testTwoPhaseMinScore
public void testTwoPhaseMinScore() throws Exception {
Term term = randomTerm();
Query query = new TermQuery(term);
Float minScore = random().nextFloat();
FunctionScoreQuery fsq1 = new FunctionScoreQuery(query, null, minScore, null, Float.POSITIVE_INFINITY);
FunctionScoreQuery fsq2 = new FunctionScoreQuery(new RandomApproximationQuery(query, random()), null, minScore, null,
Float.POSITIVE_INFINITY);
assertSameScores(fsq1, fsq2);
FiltersFunctionScoreQuery ffsq1 = new FiltersFunctionScoreQuery(query, ScoreMode.SUM, new FilterFunction[0],
Float.POSITIVE_INFINITY, minScore, CombineFunction.MULTIPLY);
FiltersFunctionScoreQuery ffsq2 = new FiltersFunctionScoreQuery(query, ScoreMode.SUM, new FilterFunction[0],
Float.POSITIVE_INFINITY, minScore, CombineFunction.MULTIPLY);
assertSameScores(ffsq1, ffsq2);
}
示例3: testMinScoreAllIncluded
public void testMinScoreAllIncluded() throws Exception {
Term term = randomTerm();
Query query = new TermQuery(term);
FunctionScoreQuery fsq = new FunctionScoreQuery(query, null, 0f, null, Float.POSITIVE_INFINITY);
assertSameScores(query, fsq);
FiltersFunctionScoreQuery ffsq = new FiltersFunctionScoreQuery(query, ScoreMode.SUM, new FilterFunction[0], Float.POSITIVE_INFINITY,
0f, CombineFunction.MULTIPLY);
assertSameScores(query, ffsq);
}
示例4: testMinScoreAllExcluded
public void testMinScoreAllExcluded() throws Exception {
Term term = randomTerm();
Query query = new TermQuery(term);
FunctionScoreQuery fsq = new FunctionScoreQuery(query, null, Float.POSITIVE_INFINITY, null, Float.POSITIVE_INFINITY);
assertSameScores(new MatchNoDocsQuery(), fsq);
FiltersFunctionScoreQuery ffsq = new FiltersFunctionScoreQuery(query, ScoreMode.SUM, new FilterFunction[0], Float.POSITIVE_INFINITY,
Float.POSITIVE_INFINITY, CombineFunction.MULTIPLY);
assertSameScores(new MatchNoDocsQuery(), ffsq);
}
示例5: testWeightOnlyCreatesBoostFunction
public void testWeightOnlyCreatesBoostFunction() throws IOException {
FunctionScoreQuery filtersFunctionScoreQueryWithWeights = new FunctionScoreQuery(new MatchAllDocsQuery(),
new WeightFactorFunction(2), 0.0f, CombineFunction.MULTIPLY, 100);
TopDocs topDocsWithWeights = searcher.search(filtersFunctionScoreQueryWithWeights, 1);
float score = topDocsWithWeights.scoreDocs[0].score;
assertThat(score, equalTo(2.0f));
}
示例6: buildFunctionScore
public Query buildFunctionScore() {
return new FunctionScoreQuery(new MatchAllDocsQuery(),
new FieldValueFactorFunction("score", FACTOR, LN2P, 0D,
new SortedNumericDVIndexFieldData(new Index("test", "123"),
"score", FLOAT)), 0F, CombineFunction.MULTIPLY, Float.MAX_VALUE);
}