From 8fb3290e5c4fdbf31bb98d3e27e004c71f1d5664 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Thu, 1 Nov 2018 11:15:26 -0700 Subject: [PATCH] Fix a bug in function_score queries where we use the wrong boost_mode. (#35148) --- .../search/function/FunctionScoreQuery.java | 7 ++++-- .../FunctionScoreQueryBuilder.java | 8 ++----- .../FunctionScoreQueryBuilderTests.java | 24 ++++++++++++++++++- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/common/lucene/search/function/FunctionScoreQuery.java b/server/src/main/java/org/elasticsearch/common/lucene/search/function/FunctionScoreQuery.java index cbf2a2400d7..fe0901c6cdb 100644 --- a/server/src/main/java/org/elasticsearch/common/lucene/search/function/FunctionScoreQuery.java +++ b/server/src/main/java/org/elasticsearch/common/lucene/search/function/FunctionScoreQuery.java @@ -123,8 +123,7 @@ public class FunctionScoreQuery extends Query { final ScoreMode scoreMode; final float maxBoost; private final Float minScore; - - protected final CombineFunction combineFunction; + private final CombineFunction combineFunction; /** * Creates a FunctionScoreQuery without function. @@ -192,6 +191,10 @@ public class FunctionScoreQuery extends Query { return minScore; } + public CombineFunction getCombineFunction() { + return combineFunction; + } + @Override public Query rewrite(IndexReader reader) throws IOException { Query rewritten = super.rewrite(reader); diff --git a/server/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryBuilder.java b/server/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryBuilder.java index b14fab84130..218b20ecad3 100644 --- a/server/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryBuilder.java +++ b/server/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryBuilder.java @@ -309,18 +309,14 @@ public class FunctionScoreQueryBuilder extends AbstractQueryBuilder