...
|
...
|
@@ -82,15 +82,6 @@ public class SearchService extends BaseService { |
|
|
// 普通构造query
|
|
|
QueryBuilder queryBuilder = searchServiceHelper.constructQueryBuilder(paramMap, indexName, isSuggest);
|
|
|
|
|
|
|
|
|
// 构造位置query
|
|
|
if (paramMap.get("longitude") != null && paramMap.get("latitude") != null ) {
|
|
|
QueryBuilder builder = searchServiceHelper.constructGeoDistanceRangeQueryBuilder(paramMap);
|
|
|
searchParam.setGeoDistanceRangeQueryBuilder(builder);
|
|
|
GeoDistanceSortBuilder sort = searchServiceHelper.constructGeoDistanceSortBuilder(paramMap);
|
|
|
searchParam.setGeoDistanceSortBuilder(sort);
|
|
|
searchParam.setGeoQuery(true);
|
|
|
}
|
|
|
//随机排序
|
|
|
if (StringUtils.isNotBlank(paramMap.get("order")) && paramMap.get("order").equals("random")) {
|
|
|
FunctionScoreQueryBuilder fsQueryBuilder = new FunctionScoreQueryBuilder(queryBuilder);
|
...
|
...
|
@@ -102,6 +93,16 @@ public class SearchService extends BaseService { |
|
|
searchParam.setQuery(queryBuilder);
|
|
|
}
|
|
|
|
|
|
// 构造位置query
|
|
|
if (paramMap.get("longitude") != null && paramMap.get("latitude") != null ) {
|
|
|
QueryBuilder builder = searchServiceHelper.constructGeoDistanceRangeQueryBuilder(paramMap);
|
|
|
searchParam.setGeoDistanceRangeQueryBuilder(builder);
|
|
|
GeoDistanceSortBuilder sort = searchServiceHelper.constructGeoDistanceSortBuilder(paramMap);
|
|
|
searchParam.setGeoDistanceSortBuilder(sort);
|
|
|
searchParam.setGeoQuery(true);
|
|
|
}
|
|
|
|
|
|
|
|
|
// 进行检索
|
|
|
searchResult = searchCommonService.doSearch(indexName, searchParam);
|
|
|
|
...
|
...
|
|