rename 'total' to 'sum', both enum and for query
This commit is contained in:
parent
6035134047
commit
c0288a62e6
|
@ -71,7 +71,7 @@ public class FiltersFunctionScoreQuery extends Query {
|
|||
}
|
||||
|
||||
public static enum ScoreMode {
|
||||
First, Avg, Max, Total, Min, Multiply
|
||||
First, Avg, Max, Sum, Min, Multiply
|
||||
}
|
||||
|
||||
Query subQuery;
|
||||
|
|
|
@ -140,7 +140,7 @@ public class CustomFiltersScoreQueryParser implements QueryParser {
|
|||
} else if ("min".equals(sScoreMode)) {
|
||||
scoreMode = FiltersFunctionScoreQuery.ScoreMode.Min;
|
||||
} else if ("total".equals(sScoreMode)) {
|
||||
scoreMode = FiltersFunctionScoreQuery.ScoreMode.Total;
|
||||
scoreMode = FiltersFunctionScoreQuery.ScoreMode.Sum;
|
||||
} else if ("multiply".equals(sScoreMode)) {
|
||||
scoreMode = FiltersFunctionScoreQuery.ScoreMode.Multiply;
|
||||
} else if ("first".equals(sScoreMode)) {
|
||||
|
|
|
@ -166,8 +166,8 @@ public class FunctionScoreQueryParser implements QueryParser {
|
|||
return FiltersFunctionScoreQuery.ScoreMode.Max;
|
||||
} else if ("min".equals(scoreMode)) {
|
||||
return FiltersFunctionScoreQuery.ScoreMode.Min;
|
||||
} else if ("total".equals(scoreMode)) {
|
||||
return FiltersFunctionScoreQuery.ScoreMode.Total;
|
||||
} else if ("sum".equals(scoreMode)) {
|
||||
return FiltersFunctionScoreQuery.ScoreMode.Sum;
|
||||
} else if ("multiply".equals(scoreMode)) {
|
||||
return FiltersFunctionScoreQuery.ScoreMode.Multiply;
|
||||
} else if ("first".equals(scoreMode)) {
|
||||
|
|
|
@ -864,7 +864,7 @@ public class CustomScoreSearchTests extends AbstractSharedClusterTest {
|
|||
assertThat(searchResponse.getHits().getAt(3).score(), equalTo(1.0f));
|
||||
|
||||
searchResponse = client().prepareSearch("test")
|
||||
.setQuery(functionScoreQuery(matchAllQuery()).scoreMode("total").add(termFilter("field", "value4"), new FactorBuilder().boostFactor(2)).add(termFilter("field", "value1"), new FactorBuilder().boostFactor(3)).add(termFilter("color", "red"), new FactorBuilder().boostFactor(5)))
|
||||
.setQuery(functionScoreQuery(matchAllQuery()).scoreMode("sum").add(termFilter("field", "value4"), new FactorBuilder().boostFactor(2)).add(termFilter("field", "value1"), new FactorBuilder().boostFactor(3)).add(termFilter("color", "red"), new FactorBuilder().boostFactor(5)))
|
||||
.setExplain(true)
|
||||
.execute().actionGet();
|
||||
|
||||
|
|
Loading…
Reference in New Issue