...
|
...
|
@@ -20,6 +20,16 @@ import java.util.*; |
|
|
@Service
|
|
|
public class SearchServiceHelper {
|
|
|
|
|
|
//store_name^1000,store_english_name^1000,store_name_tc^1000,store_first^500,address_full^300,des^100
|
|
|
public final static Map<String, Float> boostMap = new HashMap<String, Float>() {{
|
|
|
put("store_name", 1000f);
|
|
|
put("store_english_name", 1000f);
|
|
|
put("store_name_tc", 1000f);
|
|
|
put("store_first", 500f);
|
|
|
put("address_full", 300f);
|
|
|
put("des", 100f);
|
|
|
}};
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 构造距离查询范围
|
...
|
...
|
@@ -107,7 +117,9 @@ public class SearchServiceHelper { |
|
|
if (paramMap.containsKey("queryField") && StringUtils.isNotBlank(paramMap.get("queryField"))) {
|
|
|
String[] fields = paramMap.get("queryField").split(",");
|
|
|
for (int i = 0; i < fields.length; i++) {
|
|
|
queryBuilder.field(fields[i]);
|
|
|
if (boostMap.containsKey(fields[i])) {
|
|
|
queryBuilder.field(fields[i], boostMap.get(fields[i]));
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
//设置searchfield和权重
|
...
|
...
|
|