Commit f9e97156 by 田超

Merge branch 'fixbug/esTempletSort' into 'master'

bug: [none] ES搜索-没输入关键时,立项排前面

See merge request rays/pcloud-book!1103
parents cdc2d710 84cdfd16
...@@ -317,6 +317,9 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz { ...@@ -317,6 +317,9 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
} }
// 排序:因为涉及分词,故而_score固定放在第一位 // 排序:因为涉及分词,故而_score固定放在第一位
Sort sort = new Sort(Sort.Direction.DESC, "_score", "isApproval", "isFundSupport", "fundBookValue", "resourceCount", "isAdviserBook", "lastModifiedDate", "bookId"); Sort sort = new Sort(Sort.Direction.DESC, "_score", "isApproval", "isFundSupport", "fundBookValue", "resourceCount", "isAdviserBook", "lastModifiedDate", "bookId");
if(StringUtil.isEmpty(keyword)){
sort = new Sort(Sort.Direction.DESC, "isApproval", "_score", "isFundSupport", "fundBookValue", "resourceCount", "isAdviserBook", "lastModifiedDate", "bookId");
}
PageRequest pageRequest = new PageRequest(currentPage, numPerPage, sort); PageRequest pageRequest = new PageRequest(currentPage, numPerPage, sort);
Page<ESBookAndAdviser> search = bookAndAdviserRepository.search(boolQueryBuilder, pageRequest); Page<ESBookAndAdviser> search = bookAndAdviserRepository.search(boolQueryBuilder, pageRequest);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment