...
|
...
|
@@ -16,11 +16,6 @@ import com.yoho.search.service.helper.SearchSortHelper; |
|
|
*/
|
|
|
public class BaseService {
|
|
|
|
|
|
@Autowired
|
|
|
private SearchParamHelper searchParamHelper;
|
|
|
@Autowired
|
|
|
private SearchSortHelper searchSortHelper;
|
|
|
|
|
|
/**
|
|
|
* 增加一个termsQuery
|
|
|
*/
|
...
|
...
|
@@ -43,21 +38,6 @@ public class BaseService { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 增加一个rangeQuery
|
|
|
*/
|
|
|
protected BoolQueryBuilder boolQueryBuilderGte(Map<String, String> paramMap, BoolQueryBuilder boolFilter, String fieldName) {
|
|
|
if (paramMap.containsKey(fieldName) && StringUtils.isNotBlank(paramMap.get(fieldName))) {
|
|
|
int begin = Integer.parseInt(paramMap.get(fieldName));
|
|
|
if (begin == 0) {
|
|
|
boolFilter.must(QueryBuilders.termQuery(fieldName, begin));
|
|
|
} else {
|
|
|
boolFilter.must(QueryBuilders.rangeQuery(fieldName).gte(begin));
|
|
|
}
|
|
|
}
|
|
|
return boolFilter;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 通用的过滤请求
|
|
|
*/
|
|
|
protected BoolQueryBuilder generalHandler(Map<String, String> paramMap, BoolQueryBuilder boolFilter) {
|
...
|
...
|
@@ -82,14 +62,6 @@ public class BaseService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
protected int getPageSize(Map<String, String> paramMap) {
|
|
|
int pageSize = StringUtils.isBlank(paramMap.get("viewNum")) ? 30 : Integer.parseInt(paramMap.get("viewNum"));
|
|
|
if (pageSize > 100) {
|
|
|
pageSize = 100;
|
|
|
}
|
|
|
return pageSize;
|
|
|
}
|
|
|
|
|
|
protected int getPage(Map<String, String> paramMap) {
|
|
|
int page = StringUtils.isBlank(paramMap.get("page")) ? 1 : Integer.parseInt(paramMap.get("page"));
|
|
|
return page;
|
...
|
...
|
|