From c0288a62e653f66df2b6b0d0786aa3f36bdc1eb0 Mon Sep 17 00:00:00 2001 From: Britta Weber Date: Fri, 16 Aug 2013 15:20:16 +0200 Subject: [PATCH] rename 'total' to 'sum', both enum and for query --- .../lucene/search/function/FiltersFunctionScoreQuery.java | 2 +- .../index/query/CustomFiltersScoreQueryParser.java | 2 +- .../index/query/functionscore/FunctionScoreQueryParser.java | 4 ++-- .../search/customscore/CustomScoreSearchTests.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/elasticsearch/common/lucene/search/function/FiltersFunctionScoreQuery.java b/src/main/java/org/elasticsearch/common/lucene/search/function/FiltersFunctionScoreQuery.java index b4ba7fb9c4b..7e10c626270 100644 --- a/src/main/java/org/elasticsearch/common/lucene/search/function/FiltersFunctionScoreQuery.java +++ b/src/main/java/org/elasticsearch/common/lucene/search/function/FiltersFunctionScoreQuery.java @@ -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; diff --git a/src/main/java/org/elasticsearch/index/query/CustomFiltersScoreQueryParser.java b/src/main/java/org/elasticsearch/index/query/CustomFiltersScoreQueryParser.java index 4de65d20f75..276e2eae088 100644 --- a/src/main/java/org/elasticsearch/index/query/CustomFiltersScoreQueryParser.java +++ b/src/main/java/org/elasticsearch/index/query/CustomFiltersScoreQueryParser.java @@ -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)) { diff --git a/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryParser.java b/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryParser.java index e63380076c7..f28c87c0708 100644 --- a/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryParser.java +++ b/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryParser.java @@ -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)) { diff --git a/src/test/java/org/elasticsearch/test/integration/search/customscore/CustomScoreSearchTests.java b/src/test/java/org/elasticsearch/test/integration/search/customscore/CustomScoreSearchTests.java index 4cc6b2a8414..3d7dbb77b1f 100644 --- a/src/test/java/org/elasticsearch/test/integration/search/customscore/CustomScoreSearchTests.java +++ b/src/test/java/org/elasticsearch/test/integration/search/customscore/CustomScoreSearchTests.java @@ -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();