文档库--搜索(全部)
This commit is contained in:
+21
-4
@@ -2,10 +2,10 @@ package com.jero.common.es;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.jero.common.util.RestUtil;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
@@ -13,7 +13,11 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 关于 ElasticSearch 的一些方法(创建索引、添加数据、查询等)
|
||||
@@ -418,11 +422,24 @@ public class JeroElasticsearchTemplate {
|
||||
* @param size 返回条目数
|
||||
* @return { "query": query }
|
||||
*/
|
||||
public JSONObject buildQuery(List<String> _source, JSONObject query,String sort, int from, int size) {
|
||||
// public JSONObject buildQuery(List<String> _source, JSONObject query,List<Map<String, Object>> highlight,String sort, int from, int size) {
|
||||
// JSONObject json = new JSONObject();
|
||||
// if (_source != null) {
|
||||
// json.put("_source", _source);
|
||||
// }
|
||||
// json.put("highlight", highlight);
|
||||
// json.put("query", query);
|
||||
// json.put("from", from);
|
||||
// json.put("size", size);
|
||||
//// json.put("sort", sort);
|
||||
// return json;
|
||||
// }
|
||||
public JSONObject buildQuery(List<String> _source, JSONObject query,Map<String, Object> highlight,String sort, int from, int size) {
|
||||
JSONObject json = new JSONObject();
|
||||
if (_source != null) {
|
||||
json.put("_source", _source);
|
||||
}
|
||||
json.put("highlight", highlight);
|
||||
json.put("query", query);
|
||||
json.put("from", from);
|
||||
json.put("size", size);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.jero.common.config;
|
||||
package com.jero.common.esconfig;
|
||||
|
||||
import com.jero.common.util.SpringContextHolder;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
Reference in New Issue
Block a user