Showing
1 changed file
with
10 additions
and
5 deletions
@@ -34,9 +34,14 @@ public class SearchSortHelper { | @@ -34,9 +34,14 @@ public class SearchSortHelper { | ||
34 | orderValues.add("id:desc"); | 34 | orderValues.add("id:desc"); |
35 | orderValues.add("id:asc"); | 35 | orderValues.add("id:asc"); |
36 | 36 | ||
37 | + // 假上新时间 | ||
37 | orderValues.add("shelve_time:desc"); | 38 | orderValues.add("shelve_time:desc"); |
38 | orderValues.add("shelve_time:asc"); | 39 | orderValues.add("shelve_time:asc"); |
39 | 40 | ||
41 | + // 真上新时间 | ||
42 | + orderValues.add("first_shelve_time:desc"); | ||
43 | + orderValues.add("first_shelve_time:asc"); | ||
44 | + | ||
40 | orderValues.add("sales_price:asc"); | 45 | orderValues.add("sales_price:asc"); |
41 | orderValues.add("sales_price:desc"); | 46 | orderValues.add("sales_price:desc"); |
42 | 47 | ||
@@ -92,14 +97,14 @@ public class SearchSortHelper { | @@ -92,14 +97,14 @@ public class SearchSortHelper { | ||
92 | return realOrder.toString().replaceFirst(",", ""); | 97 | return realOrder.toString().replaceFirst(",", ""); |
93 | } | 98 | } |
94 | 99 | ||
95 | - public String dealSortField(String sortField){ | 100 | + public String dealSortField(String sortField) { |
96 | String[] sortParts = sortField.split(":"); | 101 | String[] sortParts = sortField.split(":"); |
97 | String realSortField = sortParts[0]; | 102 | String realSortField = sortParts[0]; |
98 | if (realSortField.contains("activities")) { | 103 | if (realSortField.contains("activities")) { |
99 | // do nothing | 104 | // do nothing |
100 | - }else if (realSortField.contains("pools")) { | 105 | + } else if (realSortField.contains("pools")) { |
101 | // do nothing | 106 | // do nothing |
102 | - }else if (realSortField.equals("discount")) { | 107 | + } else if (realSortField.equals("discount")) { |
103 | realSortField = "promotionDiscount"; | 108 | realSortField = "promotionDiscount"; |
104 | } else { | 109 | } else { |
105 | realSortField = CharUtils.underlineToCamelhump(realSortField); | 110 | realSortField = CharUtils.underlineToCamelhump(realSortField); |
@@ -192,7 +197,7 @@ public class SearchSortHelper { | @@ -192,7 +197,7 @@ public class SearchSortHelper { | ||
192 | activitySort.setNestedFilter(activitiesTermsBuilder); | 197 | activitySort.setNestedFilter(activitiesTermsBuilder); |
193 | } | 198 | } |
194 | sortBuilders.add(activitySort); | 199 | sortBuilders.add(activitySort); |
195 | - } else if(fieldName.contains("pools")){ | 200 | + } else if (fieldName.contains("pools")) { |
196 | BoolQueryBuilder poolsTermsBuilder = searchCommonHelper.getPoolIdTermsBuilder(paramMap); | 201 | BoolQueryBuilder poolsTermsBuilder = searchCommonHelper.getPoolIdTermsBuilder(paramMap); |
197 | String flag = sortOrder.toString().equals("desc") ? "_last" : "_first"; | 202 | String flag = sortOrder.toString().equals("desc") ? "_last" : "_first"; |
198 | FieldSortBuilder poolsIdSort = SortBuilders.fieldSort(fieldName).order(sortOrder).setNestedPath("pools").missing(flag); | 203 | FieldSortBuilder poolsIdSort = SortBuilders.fieldSort(fieldName).order(sortOrder).setNestedPath("pools").missing(flag); |
@@ -200,7 +205,7 @@ public class SearchSortHelper { | @@ -200,7 +205,7 @@ public class SearchSortHelper { | ||
200 | poolsIdSort.setNestedFilter(poolsTermsBuilder); | 205 | poolsIdSort.setNestedFilter(poolsTermsBuilder); |
201 | } | 206 | } |
202 | sortBuilders.add(poolsIdSort); | 207 | sortBuilders.add(poolsIdSort); |
203 | - }else { | 208 | + } else { |
204 | this.addSortBuildSorts(sortBuilders, filteredFieldNames, fieldName, sortOrder); | 209 | this.addSortBuildSorts(sortBuilders, filteredFieldNames, fieldName, sortOrder); |
205 | } | 210 | } |
206 | } | 211 | } |
-
Please register or login to post a comment