...
|
...
|
@@ -18,6 +18,7 @@ import com.yoho.search.service.utils.SearchApiResultUtils; |
|
|
import com.yoho.search.service.utils.SearchRequestParams;
|
|
|
import com.yoho.search.service.vo.SearchApiResult;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.elasticsearch.index.query.*;
|
|
|
import org.elasticsearch.search.SearchHit;
|
...
|
...
|
@@ -222,6 +223,9 @@ public class ShopsServiceImpl extends BaseService implements IShopsService, Appl |
|
|
if (keyword.contains("%")) {
|
|
|
keyword.replace("%", "percent");// 特殊处理
|
|
|
}
|
|
|
if (keyword.equals("耐克")) {
|
|
|
keyword = "nike";
|
|
|
}
|
|
|
// 编码转换
|
|
|
String is_encode = paramMap.get("is_encode");
|
|
|
if (StringUtils.isNotBlank(is_encode) && is_encode.equals("1")) {
|
...
|
...
|
@@ -238,19 +242,19 @@ public class ShopsServiceImpl extends BaseService implements IShopsService, Appl |
|
|
returnMap.put("brand", null);
|
|
|
returnMap.put("tblBrand", null);
|
|
|
//tbl判断
|
|
|
if (paramMap.containsKey("contain_global") && "Y".equals(paramMap.get("contain_global"))) {
|
|
|
searchApiResult = searchTbl(paramMap, keyword);
|
|
|
if (searchApiResult.getData() != null) {
|
|
|
Map<String, Object> shopInfoMap = (Map<String, Object>) searchApiResult.getData();
|
|
|
JSONObject shopDataMap = new JSONObject();
|
|
|
Integer shopIdNumber = Integer.valueOf(shopInfoMap.get("shopsId").toString());
|
|
|
shopDataMap.put("brand_id", shopIdNumber * (-1));
|
|
|
shopDataMap.put("brand_name", shopInfoMap.get("shopName") == null ? "" : shopInfoMap.get("shopName"));
|
|
|
shopDataMap.put("brand_logo", shopInfoMap.get("shopLogo") == null ? "" : shopInfoMap.get("shopLogo"));
|
|
|
returnMap.put("tblBrand", shopDataMap);
|
|
|
return searchApiResult.setData(returnMap);
|
|
|
}
|
|
|
//if (paramMap.containsKey("contain_global") && "Y".equals(paramMap.get("contain_global"))) {
|
|
|
searchApiResult = searchTbl(paramMap, keyword);
|
|
|
if (searchApiResult.getData() != null) {
|
|
|
Map<String, Object> shopInfoMap = (Map<String, Object>) searchApiResult.getData();
|
|
|
JSONObject shopDataMap = new JSONObject();
|
|
|
Integer shopIdNumber = Integer.valueOf(shopInfoMap.get("shopsId").toString());
|
|
|
shopDataMap.put("brand_id", shopIdNumber * (-1));
|
|
|
shopDataMap.put("brand_name", shopInfoMap.get("shopName") == null ? "" : shopInfoMap.get("shopName"));
|
|
|
shopDataMap.put("brand_logo", shopInfoMap.get("shopLogo") == null ? "" : shopInfoMap.get("shopLogo"));
|
|
|
returnMap.put("tblBrand", shopDataMap);
|
|
|
return searchApiResult.setData(returnMap);
|
|
|
}
|
|
|
//}
|
|
|
|
|
|
// 2、配置keyword的查询字段以及权重设置
|
|
|
MultiMatchQueryBuilder queryBuilder = QueryBuilders.multiMatchQuery(keyword);
|
...
|
...
|
@@ -389,7 +393,13 @@ public class ShopsServiceImpl extends BaseService implements IShopsService, Appl |
|
|
dataMapMap.put(lt.getKeyAsString(), map);
|
|
|
//处理品牌信息
|
|
|
Map<String, Object> shopsInfo = shopInfoMap.get(lt.getKeyAsString());
|
|
|
map.put("info", shopsInfo);
|
|
|
Map<String, Object> shopDataMap = new HashedMap();
|
|
|
shopDataMap.put("shop_id", shopsInfo.get("shopsId"));
|
|
|
shopDataMap.put("shop_name", shopsInfo.get("shopName") == null ? "" : shopsInfo.get("shopName"));
|
|
|
shopDataMap.put("shop_logo", shopsInfo.get("shopLogo") == null ? "" : shopsInfo.get("shopLogo"));
|
|
|
shopDataMap.put("shop_domain", shopsInfo.get("shopDomain") == null ? "" : shopsInfo.get("shopDomain"));
|
|
|
shopDataMap.put("shop_type", shopsInfo.get("shopsType") == null ? "" : shopsInfo.get("shopsType"));
|
|
|
map.put("info", shopDataMap);
|
|
|
dataMapMap.put(lt.getKeyAsString(), map);
|
|
|
}
|
|
|
try {
|
...
|
...
|
@@ -533,9 +543,9 @@ public class ShopsServiceImpl extends BaseService implements IShopsService, Appl |
|
|
int[] shopsIds = ConvertUtils.stringToIntArray(paramMap.get(SearchRequestParams.PARAM_SEARCH_SHOP), ",");
|
|
|
boolFilter.must(QueryBuilders.termsQuery("shopsId", shopsIds));
|
|
|
}
|
|
|
if (!paramMap.containsKey("contain_global") && !"Y".equals(paramMap.get("contain_global"))) {
|
|
|
boolFilter = boolFilter.must(QueryBuilders.termQuery("isGlobal", "N"));
|
|
|
}
|
|
|
// if (!paramMap.containsKey("contain_global") && !"Y".equals(paramMap.get("contain_global"))) {
|
|
|
// boolFilter = boolFilter.must(QueryBuilders.termQuery("isGlobal", "N"));
|
|
|
// }
|
|
|
boolFilter = BoolQueryTermQuery(paramMap, boolFilter, SearchRequestParams.SHOPS_PARAM_BLKSTATUS);
|
|
|
boolFilter = BoolQueryTermQuery(paramMap, boolFilter, SearchRequestParams.SHOPS_PARAM_CHECKSTATUS);
|
|
|
boolFilter = BoolQueryTermQuery(paramMap, boolFilter, SearchRequestParams.SHOPS_PARAM_EXAMINESTATUS);
|
...
|
...
|
|