本文整理汇总了Java中org.elasticsearch.common.lucene.search.function.CombineFunction类的典型用法代码示例。如果您正苦于以下问题:Java CombineFunction类的具体用法?Java CombineFunction怎么用?Java CombineFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CombineFunction类属于org.elasticsearch.common.lucene.search.function包,在下文中一共展示了CombineFunction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: minMaxQuery
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
private SearchResponse minMaxQuery(ScoreMode scoreMode, int minChildren, Integer maxChildren) throws SearchPhaseExecutionException {
HasChildQueryBuilder hasChildQuery = hasChildQuery(
"child",
QueryBuilders.functionScoreQuery(constantScoreQuery(QueryBuilders.termQuery("foo", "two")),
new FunctionScoreQueryBuilder.FilterFunctionBuilder[]{
new FunctionScoreQueryBuilder.FilterFunctionBuilder(weightFactorFunction(1)),
new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.termQuery("foo", "three"), weightFactorFunction(1)),
new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.termQuery("foo", "four"), weightFactorFunction(1))
}).boostMode(CombineFunction.REPLACE).scoreMode(FiltersFunctionScoreQuery.ScoreMode.SUM), scoreMode)
.minMaxChildren(minChildren, maxChildren != null ? maxChildren : HasChildQueryBuilder.DEFAULT_MAX_CHILDREN);
return client()
.prepareSearch("test")
.setQuery(hasChildQuery)
.addSort("_score", SortOrder.DESC).addSort("id", SortOrder.ASC).get();
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:ChildQuerySearchIT.java
示例2: buildFunctionScoreQuery
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
protected QueryBuilder buildFunctionScoreQuery(final String query, final QueryBuilder queryBuilder) {
final List<FunctionScoreQueryBuilder.FilterFunctionBuilder> flist = new ArrayList<>();
if (isSingleWordQuery(query) && !isHiraganaQuery(query)) {
flist.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.prefixQuery(FieldNames.TEXT, query),
ScoreFunctionBuilders.weightFactorFunction(prefixMatchWeight)));
}
flist.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(ScoreFunctionBuilders.fieldValueFactorFunction(FieldNames.DOC_FREQ)
.missing(0.1f).modifier(FieldValueFactorFunction.Modifier.LOG2P).setWeight(1.0F)));
flist.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(ScoreFunctionBuilders.fieldValueFactorFunction(FieldNames.QUERY_FREQ)
.missing(0.1f).modifier(FieldValueFactorFunction.Modifier.LOG2P).setWeight(1.0F)));
flist.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(ScoreFunctionBuilders.fieldValueFactorFunction(FieldNames.USER_BOOST)
.missing(1f).setWeight(1.0F)));
final FunctionScoreQueryBuilder functionScoreQueryBuilder =
QueryBuilders.functionScoreQuery(queryBuilder,
flist.toArray(new FunctionScoreQueryBuilder.FilterFunctionBuilder[flist.size()]));
functionScoreQueryBuilder.boostMode(CombineFunction.REPLACE);
functionScoreQueryBuilder.scoreMode(FunctionScoreQuery.ScoreMode.MULTIPLY);
return functionScoreQueryBuilder;
}
开发者ID:codelibs,项目名称:fess-suggest,代码行数:25,代码来源:SuggestRequest.java
示例3: testScore
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
public void testScore() throws Exception {
createIndex("test");
ensureGreen("test");
indexRandom(true,
client().prepareIndex("test", "doc", "1").setSource("text", "hello goodbye"),
client().prepareIndex("test", "doc", "2").setSource("text", "hello hello hello goodbye"),
client().prepareIndex("test", "doc", "3").setSource("text", "hello hello goodebye"));
ScoreFunctionBuilder<?> score = ScoreFunctionBuilders.scriptFunction(new Script(ScriptType.INLINE, "expression", "1 / _score", Collections.emptyMap()));
SearchRequestBuilder req = client().prepareSearch().setIndices("test");
req.setQuery(QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("text", "hello"), score).boostMode(CombineFunction.REPLACE));
req.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); // make sure DF is consistent
SearchResponse rsp = req.get();
assertSearchResponse(rsp);
SearchHits hits = rsp.getHits();
assertEquals(3, hits.getTotalHits());
assertEquals("1", hits.getAt(0).getId());
assertEquals("3", hits.getAt(1).getId());
assertEquals("2", hits.getAt(2).getId());
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:MoreExpressionTests.java
示例4: AbstractDistanceScoreFunction
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
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;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:DecayFunctionBuilder.java
示例5: testWithEmptyFunctions
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
/** make sure min_score works if functions is empty, see https://github.com/elastic/elasticsearch/issues/10253 */
public void testWithEmptyFunctions() throws IOException, ExecutionException, InterruptedException {
assertAcked(prepareCreate("test"));
index("test", "testtype", "1", jsonBuilder().startObject().field("text", "test text").endObject());
refresh();
SearchResponse termQuery = client().search(
searchRequest().source(
searchSource().explain(true).query(
termQuery("text", "text")))).get();
assertSearchResponse(termQuery);
assertThat(termQuery.getHits().getTotalHits(), equalTo(1L));
float termQueryScore = termQuery.getHits().getAt(0).getScore();
for (CombineFunction combineFunction : CombineFunction.values()) {
testMinScoreApplied(combineFunction, termQueryScore);
}
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:FunctionScoreIT.java
示例6: testMinScoreApplied
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
protected void testMinScoreApplied(CombineFunction boostMode, float expectedScore) throws InterruptedException, ExecutionException {
SearchResponse response = client().search(
searchRequest().source(
searchSource().explain(true).query(
functionScoreQuery(termQuery("text", "text")).boostMode(boostMode).setMinScore(0.1f)))).get();
assertSearchResponse(response);
assertThat(response.getHits().getTotalHits(), equalTo(1L));
assertThat(response.getHits().getAt(0).getScore(), equalTo(expectedScore));
response = client().search(
searchRequest().source(
searchSource().explain(true).query(
functionScoreQuery(termQuery("text", "text")).boostMode(boostMode).setMinScore(2f)))).get();
assertSearchResponse(response);
assertThat(response.getHits().getTotalHits(), equalTo(0L));
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:FunctionScoreIT.java
示例7: doCreateTestQueryBuilder
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
@Override
protected FunctionScoreQueryBuilder doCreateTestQueryBuilder() {
FunctionScoreQueryBuilder functionScoreQueryBuilder = createRandomFunctionScoreBuilder();
if (randomBoolean()) {
functionScoreQueryBuilder.boostMode(randomFrom(CombineFunction.values()));
}
if (randomBoolean()) {
functionScoreQueryBuilder.scoreMode(randomFrom(FiltersFunctionScoreQuery.ScoreMode.values()));
}
if (randomBoolean()) {
functionScoreQueryBuilder.maxBoost(randomFloat());
}
if (randomBoolean()) {
functionScoreQueryBuilder.setMinScore(randomFloat());
}
return functionScoreQueryBuilder;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:FunctionScoreQueryBuilderTests.java
示例8: testTwoPhaseMinScore
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
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);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:FunctionScoreEquivalenceTests.java
示例9: testWeightFactorNeedsScore
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
public void testWeightFactorNeedsScore() {
for (boolean needsScore : new boolean[] {true, false}) {
WeightFactorFunction function = new WeightFactorFunction(10.0f, new ScoreFunction(CombineFunction.REPLACE) {
@Override
public LeafScoreFunction getLeafScoreFunction(LeafReaderContext ctx) throws IOException {
return null;
}
@Override
public boolean needsScores() {
return needsScore;
}
@Override
protected boolean doEquals(ScoreFunction other) {
return false;
}
@Override
protected int doHashCode() {
return 0;
}
});
assertEquals(needsScore, function.needsScores());
}
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:27,代码来源:FunctionScoreTests.java
示例10: AbstractDistanceScoreFunction
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
public AbstractDistanceScoreFunction(double userSuppiedScale, double decay, double offset, DecayFunction func, MultiValueMode mode) {
super(CombineFunction.MULT);
this.mode = mode;
if (userSuppiedScale <= 0.0) {
throw new IllegalArgumentException(FunctionScoreQueryParser.NAME + " : scale must be > 0.0.");
}
if (decay <= 0.0 || decay >= 1.0) {
throw new IllegalArgumentException(FunctionScoreQueryParser.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(FunctionScoreQueryParser.NAME + " : offset must be > 0.0");
}
this.offset = offset;
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:18,代码来源:DecayFunctionParser.java
示例11: FunctionScoreQueryBuilder
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
/**
* Read from a stream.
*/
public FunctionScoreQueryBuilder(StreamInput in) throws IOException {
super(in);
query = in.readNamedWriteable(QueryBuilder.class);
filterFunctionBuilders = in.readList(FilterFunctionBuilder::new).toArray(new FilterFunctionBuilder[0]);
maxBoost = in.readFloat();
minScore = in.readOptionalFloat();
boostMode = in.readOptionalWriteable(CombineFunction::readFromStream);
scoreMode = FiltersFunctionScoreQuery.ScoreMode.readFromStream(in);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:FunctionScoreQueryBuilder.java
示例12: boostMode
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
/**
* Boost mode defines how the combined result of score functions will influence the final score together with the sub query score.
* @see CombineFunction
*/
public FunctionScoreQueryBuilder boostMode(CombineFunction combineFunction) {
if (combineFunction == null) {
throw new IllegalArgumentException("[" + NAME + "] requires 'boost_mode' field");
}
this.boostMode = combineFunction;
return this;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:FunctionScoreQueryBuilder.java
示例13: testEnforceWindowSize
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
public void testEnforceWindowSize() {
createIndex("test");
// this
int iters = scaledRandomIntBetween(10, 20);
for (int i = 0; i < iters; i ++) {
client().prepareIndex("test", "type", Integer.toString(i)).setSource("f", Integer.toString(i)).execute().actionGet();
}
refresh();
int numShards = getNumShards("test").numPrimaries;
for (int j = 0 ; j < iters; j++) {
SearchResponse searchResponse = client().prepareSearch()
.setQuery(QueryBuilders.matchAllQuery())
.setRescorer(queryRescorer(
QueryBuilders.functionScoreQuery(QueryBuilders.matchAllQuery(),
ScoreFunctionBuilders.weightFactorFunction(100)).boostMode(CombineFunction.REPLACE))
.setQueryWeight(0.0f).setRescoreQueryWeight(1.0f), 1).setSize(randomIntBetween(2, 10)).execute()
.actionGet();
assertSearchResponse(searchResponse);
assertFirstHit(searchResponse, hasScore(100.f));
int numDocsWith100AsAScore = 0;
for (int i = 0; i < searchResponse.getHits().getHits().length; i++) {
float score = searchResponse.getHits().getHits()[i].getScore();
if (score == 100f) {
numDocsWith100AsAScore += 1;
}
}
assertThat(searchResponse.getHits().getMaxScore(), equalTo(searchResponse.getHits().getHits()[0].getScore()));
// we cannot assert that they are equal since some shards might not have docs at all
assertThat(numDocsWith100AsAScore, lessThanOrEqualTo(numShards));
}
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:33,代码来源:QueryRescorerIT.java
示例14: testMultipleRescores
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
public void testMultipleRescores() throws Exception {
int numDocs = indexRandomNumbers("keyword", 1, true);
QueryRescorerBuilder eightIsGreat = RescoreBuilder
.queryRescorer(QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("field1", English.intToEnglish(8)),
ScoreFunctionBuilders.weightFactorFunction(1000.0f)).boostMode(CombineFunction.REPLACE))
.setScoreMode(QueryRescoreMode.Total);
QueryRescorerBuilder sevenIsBetter = RescoreBuilder
.queryRescorer(QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("field1", English.intToEnglish(7)),
ScoreFunctionBuilders.weightFactorFunction(10000.0f)).boostMode(CombineFunction.REPLACE))
.setScoreMode(QueryRescoreMode.Total);
// First set the rescore window large enough that both rescores take effect
SearchRequestBuilder request = client().prepareSearch();
request.addRescorer(eightIsGreat, numDocs).addRescorer(sevenIsBetter, numDocs);
SearchResponse response = request.get();
assertFirstHit(response, hasId("7"));
assertSecondHit(response, hasId("8"));
// Now squash the second rescore window so it never gets to see a seven
response = request.setSize(1).clearRescorers().addRescorer(eightIsGreat, numDocs).addRescorer(sevenIsBetter, 1).get();
assertFirstHit(response, hasId("8"));
// We have no idea what the second hit will be because we didn't get a chance to look for seven
// Now use one rescore to drag the number we're looking for into the window of another
QueryRescorerBuilder ninetyIsGood = RescoreBuilder.queryRescorer(QueryBuilders
.functionScoreQuery(QueryBuilders.queryStringQuery("*ninety*"), ScoreFunctionBuilders.weightFactorFunction(1000.0f))
.boostMode(CombineFunction.REPLACE)).setScoreMode(QueryRescoreMode.Total);
QueryRescorerBuilder oneToo = RescoreBuilder.queryRescorer(QueryBuilders
.functionScoreQuery(QueryBuilders.queryStringQuery("*one*"), ScoreFunctionBuilders.weightFactorFunction(1000.0f))
.boostMode(CombineFunction.REPLACE)).setScoreMode(QueryRescoreMode.Total);
request.clearRescorers().addRescorer(ninetyIsGood, numDocs).addRescorer(oneToo, 10);
response = request.setSize(2).get();
assertThat(response.getHits().getMaxScore(), equalTo(response.getHits().getHits()[0].getScore()));
assertFirstHit(response, hasId("91"));
assertFirstHit(response, hasScore(2001.0f));
assertSecondHit(response, hasScore(1001.0f)); // Not sure which one it is but it is ninety something
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:38,代码来源:QueryRescorerIT.java
示例15: testNativeExplainScript
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
public void testNativeExplainScript() throws InterruptedException, IOException, ExecutionException {
List<IndexRequestBuilder> indexRequests = new ArrayList<>();
for (int i = 0; i < 20; i++) {
indexRequests.add(client().prepareIndex("test", "type").setId(Integer.toString(i)).setSource(
jsonBuilder().startObject().field("number_field", i).field("text", "text").endObject()));
}
indexRandom(true, true, indexRequests);
client().admin().indices().prepareRefresh().execute().actionGet();
ensureYellow();
SearchResponse response = client().search(searchRequest().searchType(SearchType.QUERY_THEN_FETCH).source(
searchSource().explain(true).query(
functionScoreQuery(termQuery("text", "text"),
scriptFunction(
new Script(ScriptType.INLINE, "native", "native_explainable_script", Collections.emptyMap())))
.boostMode(CombineFunction.REPLACE)))).actionGet();
ElasticsearchAssertions.assertNoFailures(response);
SearchHits hits = response.getHits();
assertThat(hits.getTotalHits(), equalTo(20L));
int idCounter = 19;
for (SearchHit hit : hits.getHits()) {
assertThat(hit.getId(), equalTo(Integer.toString(idCounter)));
assertThat(hit.getExplanation().toString(),
containsString(Double.toString(idCounter) + " = This script returned " + Double.toString(idCounter)));
assertThat(hit.getExplanation().toString(), containsString("freq=1.0 = termFreq=1.0"));
assertThat(hit.getExplanation().getDetails().length, equalTo(2));
idCounter--;
}
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:30,代码来源:ExplainableScriptIT.java
示例16: testValidOrdinals
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
public void testValidOrdinals() {
assertThat(CombineFunction.MULTIPLY.ordinal(), equalTo(0));
assertThat(CombineFunction.REPLACE.ordinal(), equalTo(1));
assertThat(CombineFunction.SUM.ordinal(), equalTo(2));
assertThat(CombineFunction.AVG.ordinal(), equalTo(3));
assertThat(CombineFunction.MIN.ordinal(), equalTo(4));
assertThat(CombineFunction.MAX.ordinal(), equalTo(5));
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:CombineFunctionTests.java
示例17: testReadFrom
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
public void testReadFrom() throws Exception {
try (BytesStreamOutput out = new BytesStreamOutput()) {
out.writeVInt(0);
try (StreamInput in = out.bytes().streamInput()) {
assertThat(CombineFunction.readFromStream(in), equalTo(CombineFunction.MULTIPLY));
}
}
try (BytesStreamOutput out = new BytesStreamOutput()) {
out.writeVInt(1);
try (StreamInput in = out.bytes().streamInput()) {
assertThat(CombineFunction.readFromStream(in), equalTo(CombineFunction.REPLACE));
}
}
try (BytesStreamOutput out = new BytesStreamOutput()) {
out.writeVInt(2);
try (StreamInput in = out.bytes().streamInput()) {
assertThat(CombineFunction.readFromStream(in), equalTo(CombineFunction.SUM));
}
}
try (BytesStreamOutput out = new BytesStreamOutput()) {
out.writeVInt(3);
try (StreamInput in = out.bytes().streamInput()) {
assertThat(CombineFunction.readFromStream(in), equalTo(CombineFunction.AVG));
}
}
try (BytesStreamOutput out = new BytesStreamOutput()) {
out.writeVInt(4);
try (StreamInput in = out.bytes().streamInput()) {
assertThat(CombineFunction.readFromStream(in), equalTo(CombineFunction.MIN));
}
}
try (BytesStreamOutput out = new BytesStreamOutput()) {
out.writeVInt(5);
try (StreamInput in = out.bytes().streamInput()) {
assertThat(CombineFunction.readFromStream(in), equalTo(CombineFunction.MAX));
}
}
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:39,代码来源:CombineFunctionTests.java
示例18: testFromString
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
public void testFromString() {
assertThat(CombineFunction.fromString("multiply"), equalTo(CombineFunction.MULTIPLY));
assertThat(CombineFunction.fromString("replace"), equalTo(CombineFunction.REPLACE));
assertThat(CombineFunction.fromString("sum"), equalTo(CombineFunction.SUM));
assertThat(CombineFunction.fromString("avg"), equalTo(CombineFunction.AVG));
assertThat(CombineFunction.fromString("min"), equalTo(CombineFunction.MIN));
assertThat(CombineFunction.fromString("max"), equalTo(CombineFunction.MAX));
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:CombineFunctionTests.java
示例19: testRewrite
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
public void testRewrite() throws IOException {
FunctionScoreQueryBuilder functionScoreQueryBuilder =
new FunctionScoreQueryBuilder(new WrapperQueryBuilder(new TermQueryBuilder("foo", "bar").toString()))
.boostMode(CombineFunction.REPLACE)
.scoreMode(FiltersFunctionScoreQuery.ScoreMode.SUM)
.setMinScore(1)
.maxBoost(100);
FunctionScoreQueryBuilder rewrite = (FunctionScoreQueryBuilder) functionScoreQueryBuilder.rewrite(createShardContext());
assertNotSame(functionScoreQueryBuilder, rewrite);
assertEquals(rewrite.query(), new TermQueryBuilder("foo", "bar"));
assertEquals(rewrite.boostMode(), CombineFunction.REPLACE);
assertEquals(rewrite.scoreMode(), FiltersFunctionScoreQuery.ScoreMode.SUM);
assertEquals(rewrite.getMinScore(), 1f, 0.0001);
assertEquals(rewrite.maxBoost(), 100f, 0.0001);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:FunctionScoreQueryBuilderTests.java
示例20: testMinScoreAllIncluded
import org.elasticsearch.common.lucene.search.function.CombineFunction; //导入依赖的package包/类
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);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:FunctionScoreEquivalenceTests.java
注:本文中的org.elasticsearch.common.lucene.search.function.CombineFunction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论