Authored by saihide

Merge branch 'master' into recommendbrand

@@ -65,6 +65,9 @@ public class SearchSortHelper { @@ -65,6 +65,9 @@ public class SearchSortHelper {
65 orderValues.add("pools.id:desc"); 65 orderValues.add("pools.id:desc");
66 orderValues.add("pools.id:asc"); 66 orderValues.add("pools.id:asc");
67 67
  68 + orderValues.add("pools.sort:desc");
  69 + orderValues.add("pools.sort:asc");
  70 +
68 orderValues.add("brand_weight:asc"); 71 orderValues.add("brand_weight:asc");
69 orderValues.add("brand_weight:desc"); 72 orderValues.add("brand_weight:desc");
70 73
@@ -220,11 +223,11 @@ public class SearchSortHelper { @@ -220,11 +223,11 @@ public class SearchSortHelper {
220 } else if (fieldName.contains("pools")) { 223 } else if (fieldName.contains("pools")) {
221 BoolQueryBuilder poolsTermsBuilder = searchCommonHelper.getPoolIdTermsBuilder(paramMap); 224 BoolQueryBuilder poolsTermsBuilder = searchCommonHelper.getPoolIdTermsBuilder(paramMap);
222 String flag = sortOrder.toString().equals("desc") ? "_last" : "_first"; 225 String flag = sortOrder.toString().equals("desc") ? "_last" : "_first";
223 - FieldSortBuilder poolsIdSort = SortBuilders.fieldSort(fieldName).order(sortOrder).setNestedPath("pools").missing(flag);  
224 - if (poolsTermsBuilder != null) {  
225 - poolsIdSort.setNestedFilter(poolsTermsBuilder); 226 + FieldSortBuilder poolsFieldSortBuilder = SortBuilders.fieldSort(fieldName).order(sortOrder).setNestedPath("pools").missing(flag);
  227 + if (poolsFieldSortBuilder != null) {
  228 + poolsFieldSortBuilder.setNestedFilter(poolsTermsBuilder);
226 } 229 }
227 - sortBuilders.add(poolsIdSort); 230 + sortBuilders.add(poolsFieldSortBuilder);
228 } else { 231 } else {
229 this.addSortBuildSorts(sortBuilders, filteredFieldNames, fieldName, sortOrder); 232 this.addSortBuildSorts(sortBuilders, filteredFieldNames, fieldName, sortOrder);
230 } 233 }