diff --git a/src/common/es_util.py b/src/common/es_util.py index f2a5f1a0..8fd83cae 100644 --- a/src/common/es_util.py +++ b/src/common/es_util.py @@ -149,7 +149,7 @@ def search_tip_ranked_articles(elasticsearch, params, limit, page): } }, 'sort': [ - {'tip_value': 'desc'} + {'sort_tip_value': 'desc'} ], 'from': limit * (page - 1), 'size': limit diff --git a/tests/handlers/articles/tip_ranking/test_articles_tip_ranking.py b/tests/handlers/articles/tip_ranking/test_articles_tip_ranking.py index fbb270a8..1f2c10b6 100644 --- a/tests/handlers/articles/tip_ranking/test_articles_tip_ranking.py +++ b/tests/handlers/articles/tip_ranking/test_articles_tip_ranking.py @@ -37,7 +37,7 @@ def setUp(self): 'overview': 'overview02', 'status': 'public', 'topic': 'crypto', - 'tip_value': 12000000000000, + 'sort_tip_value': 12000000000000, 'sort_key': 1520150272000001 }, { @@ -48,7 +48,7 @@ def setUp(self): 'overview': 'overview03', 'status': 'public', 'topic': 'fashion', - 'tip_value': 18000000000000, + 'sort_tip_value': 18000000000000, 'sort_key': 1520150272000002 }, { @@ -59,7 +59,7 @@ def setUp(self): 'overview': 'overview04', 'status': 'public', 'topic': 'crypto', - 'tip_value': 6000000000000000000000000, + 'sort_tip_value': 6000000000000000000000000, 'sort_key': 1520150272000003 }, { @@ -70,7 +70,7 @@ def setUp(self): 'overview': 'overview05', 'status': 'public', 'topic': 'fashion', - 'tip_value': 18000000000000.1, + 'sort_tip_value': 18000000000000.1, 'sort_key': 1520150272000003 } ] @@ -119,7 +119,7 @@ def test_main(self): 'overview': 'overview04', 'status': 'public', 'topic': 'crypto', - 'tip_value': 6000000000000000000000000, + 'sort_tip_value': 6000000000000000000000000, 'sort_key': 1520150272000003 }, { @@ -130,7 +130,7 @@ def test_main(self): 'overview': 'overview05', 'status': 'public', 'topic': 'fashion', - 'tip_value': 18000000000000.1, + 'sort_tip_value': 18000000000000.1, 'sort_key': 1520150272000003 } ] @@ -152,7 +152,7 @@ def test_main_ok_with_no_limit(self): 'overview': 'overview03', 'status': 'public', 'topic': 'crypto', - 'tip_value': 18000000000000, + 'sort_tip_value': 18000000000000, 'sort_key': 1520150273000000 + i } ) @@ -185,7 +185,7 @@ def test_main_ok_with_topic(self): 'overview': 'overview05', 'status': 'public', 'topic': 'fashion', - 'tip_value': 18000000000000.1, + 'sort_tip_value': 18000000000000.1, 'sort_key': 1520150272000003 }, { @@ -196,7 +196,7 @@ def test_main_ok_with_topic(self): 'overview': 'overview03', 'status': 'public', 'topic': 'fashion', - 'tip_value': 18000000000000, + 'sort_tip_value': 18000000000000, 'sort_key': 1520150272000002 } ] @@ -223,7 +223,7 @@ def test_main_ok_with_page(self): 'overview': 'overview02', 'status': 'public', 'topic': 'crypto', - 'tip_value': 12000000000000, + 'sort_tip_value': 12000000000000, 'sort_key': 1520150272000001 } ] diff --git a/tests/tests_common/tests_es_util.py b/tests/tests_common/tests_es_util.py index cdf47705..a4a8f184 100644 --- a/tests/tests_common/tests_es_util.py +++ b/tests/tests_common/tests_es_util.py @@ -37,7 +37,7 @@ def create_tip_ranked_articles_index(elasticsearch, index_name): 'mappings': { 'article_tip_ranking': { 'properties': { - 'tip_value': { + 'sort_tip_value': { 'type': 'double' } }