springDatasolr 排序

 1        String sortValue = (String) searchMap.get("sort");// ASC DESC
 2         String sortField = (String) searchMap.get("sortField");// 排序字段
 3         if (sortValue != null && !sortValue.equals("")) {
 4             if (sortValue.equals("ASC")) {
 5                 highlightQuery.addSort(new Sort(Sort.Direction.ASC, "hyd_" + sortField));   //相当于order by
 6             }
 7             if (sortValue.equals("DESC")) {
 8                 highlightQuery.addSort(new Sort(Sort.Direction.DESC, "hyd_" + sortField));
 9             }
10         }

import org.springframework.data.domain.Sort;

posted @ 2018-08-01 16:44  好难取名  阅读(176)  评论(0编辑  收藏  举报