String sortValue = (String) searchMap.get("sort");// ASC DESC
String sortField = (String) searchMap.get("sortField");// 排序字段
if (sortValue != null && !sortValue.equals("")) {
if (sortValue.equals("ASC")) {
highlightQuery.addSort(new Sort(Sort.Direction.ASC, "hyd_" + sortField)); //相当于order by
}
if (sortValue.equals("DESC")) {
highlightQuery.addSort(new Sort(Sort.Direction.DESC, "hyd_" + sortField));
}
}

springDatasolr  排序-LMLPHP

import org.springframework.data.domain.Sort;

04-14 19:14