|
@@ -72,9 +72,12 @@ public class JudgmentDocumentsServiceImpl implements JudgmentDocumentsService {
|
|
|
|
|
|
Map<String, JudgmentDocumentsSearchType> content = searchContent.getContent();
|
|
Map<String, JudgmentDocumentsSearchType> content = searchContent.getContent();
|
|
for (Map.Entry<String, JudgmentDocumentsSearchType> entry : content.entrySet()) {
|
|
for (Map.Entry<String, JudgmentDocumentsSearchType> entry : content.entrySet()) {
|
|
|
|
+ if (StringUtils.isBlank(entry.getKey())) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
if (entry.getKey().contains(" ")) {
|
|
if (entry.getKey().contains(" ")) {
|
|
for (String s : entry.getKey().split(" +")) {
|
|
for (String s : entry.getKey().split(" +")) {
|
|
- if (StringUtils.isEmpty(s)) {
|
|
|
|
|
|
+ if (StringUtils.isBlank(s)) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
mustOrFilter(searchContent.isNotSort(), boolQuery, getSearchContentQuery(entry.getValue(), s));
|
|
mustOrFilter(searchContent.isNotSort(), boolQuery, getSearchContentQuery(entry.getValue(), s));
|
|
@@ -97,23 +100,25 @@ public class JudgmentDocumentsServiceImpl implements JudgmentDocumentsService {
|
|
List<SortBuilder> sortBuilders = new ArrayList<>();
|
|
List<SortBuilder> sortBuilders = new ArrayList<>();
|
|
if (sort == null && !searchContent.isNotSort()) {
|
|
if (sort == null && !searchContent.isNotSort()) {
|
|
String ip = searchContent.getIp();
|
|
String ip = searchContent.getIp();
|
|
- IpInfo ipInfo = winhcIpParser.parseIp(ip);
|
|
|
|
- if (ipInfo.getIpProvinceCode() != null) {
|
|
|
|
- Map<String, Object> map = new HashMap<String, Object>(2);
|
|
|
|
- map.put("provinceCode", ipInfo.getIpProvinceCode());
|
|
|
|
- map.put("cityCode", ipInfo.getIpCityCode());
|
|
|
|
-
|
|
|
|
- log.info("province: {},city: {}", ipInfo.getIpProvince(), ipInfo.getIpCity());
|
|
|
|
-
|
|
|
|
- Script script = CompanyIndexUtils.getScript("if('0'.equals(doc['court_level'].value)) return 100;" +
|
|
|
|
- "if(params.provinceCode.equals(doc['court_province_code'].value)&¶ms.cityCode==null) return 100;" +
|
|
|
|
- "if(params.provinceCode.equals(doc['court_province_code'].value)&¶ms.cityCode!=null && params.cityCode.equals(doc['court_city_code'].value)) return 100;return 0;", map);
|
|
|
|
- ScriptSortBuilder order = SortBuilders.scriptSort(script, ScriptSortBuilder.ScriptSortType.NUMBER).order(SortOrder.DESC);
|
|
|
|
|
|
+ if(StringUtils.isNotBlank(ip)){
|
|
|
|
+ IpInfo ipInfo = winhcIpParser.parseIp(ip);
|
|
|
|
+ if (ipInfo.getIpProvinceCode() != null) {
|
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>(2);
|
|
|
|
+ map.put("provinceCode", ipInfo.getIpProvinceCode());
|
|
|
|
+ map.put("cityCode", ipInfo.getIpCityCode());
|
|
|
|
+
|
|
|
|
+ log.info("province: {},city: {}", ipInfo.getIpProvince(), ipInfo.getIpCity());
|
|
|
|
+
|
|
|
|
+ Script script = CompanyIndexUtils.getScript("if('0'.equals(doc['court_level'].value)) return 100;" +
|
|
|
|
+ "if(params.provinceCode.equals(doc['court_province_code'].value)&¶ms.cityCode==null) return 100;" +
|
|
|
|
+ "if(params.provinceCode.equals(doc['court_province_code'].value)&¶ms.cityCode!=null && params.cityCode.equals(doc['court_city_code'].value)) return 100;return 0;", map);
|
|
|
|
+ ScriptSortBuilder order = SortBuilders.scriptSort(script, ScriptSortBuilder.ScriptSortType.NUMBER).order(SortOrder.DESC);
|
|
|
|
+ sortBuilders.add(order);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ FieldSortBuilder order = SortBuilders.fieldSort("case_score").order(SortOrder.DESC);
|
|
sortBuilders.add(order);
|
|
sortBuilders.add(order);
|
|
}
|
|
}
|
|
-
|
|
|
|
- FieldSortBuilder order = SortBuilders.fieldSort("case_score").order(SortOrder.DESC);
|
|
|
|
- sortBuilders.add(order);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
Object search = searchDao.search(index, type, boolQuery, null, sortBuilders, null, from, size, preference, highlightField);
|
|
Object search = searchDao.search(index, type, boolQuery, null, sortBuilders, null, from, size, preference, highlightField);
|