rename 'total' to 'sum', both enum and for query

This commit is contained in:
Britta Weber 2013-08-16 15:20:16 +02:00
parent 6035134047
commit c0288a62e6
4 changed files with 5 additions and 5 deletions

View File

@ -71,7 +71,7 @@ public class FiltersFunctionScoreQuery extends Query {
} }
public static enum ScoreMode { public static enum ScoreMode {
First, Avg, Max, Total, Min, Multiply First, Avg, Max, Sum, Min, Multiply
} }
Query subQuery; Query subQuery;

View File

@ -140,7 +140,7 @@ public class CustomFiltersScoreQueryParser implements QueryParser {
} else if ("min".equals(sScoreMode)) { } else if ("min".equals(sScoreMode)) {
scoreMode = FiltersFunctionScoreQuery.ScoreMode.Min; scoreMode = FiltersFunctionScoreQuery.ScoreMode.Min;
} else if ("total".equals(sScoreMode)) { } else if ("total".equals(sScoreMode)) {
scoreMode = FiltersFunctionScoreQuery.ScoreMode.Total; scoreMode = FiltersFunctionScoreQuery.ScoreMode.Sum;
} else if ("multiply".equals(sScoreMode)) { } else if ("multiply".equals(sScoreMode)) {
scoreMode = FiltersFunctionScoreQuery.ScoreMode.Multiply; scoreMode = FiltersFunctionScoreQuery.ScoreMode.Multiply;
} else if ("first".equals(sScoreMode)) { } else if ("first".equals(sScoreMode)) {

View File

@ -166,8 +166,8 @@ public class FunctionScoreQueryParser implements QueryParser {
return FiltersFunctionScoreQuery.ScoreMode.Max; return FiltersFunctionScoreQuery.ScoreMode.Max;
} else if ("min".equals(scoreMode)) { } else if ("min".equals(scoreMode)) {
return FiltersFunctionScoreQuery.ScoreMode.Min; return FiltersFunctionScoreQuery.ScoreMode.Min;
} else if ("total".equals(scoreMode)) { } else if ("sum".equals(scoreMode)) {
return FiltersFunctionScoreQuery.ScoreMode.Total; return FiltersFunctionScoreQuery.ScoreMode.Sum;
} else if ("multiply".equals(scoreMode)) { } else if ("multiply".equals(scoreMode)) {
return FiltersFunctionScoreQuery.ScoreMode.Multiply; return FiltersFunctionScoreQuery.ScoreMode.Multiply;
} else if ("first".equals(scoreMode)) { } else if ("first".equals(scoreMode)) {

View File

@ -864,7 +864,7 @@ public class CustomScoreSearchTests extends AbstractSharedClusterTest {
assertThat(searchResponse.getHits().getAt(3).score(), equalTo(1.0f)); assertThat(searchResponse.getHits().getAt(3).score(), equalTo(1.0f));
searchResponse = client().prepareSearch("test") 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) .setExplain(true)
.execute().actionGet(); .execute().actionGet();