|
@@ -1650,10 +1650,9 @@ public class SearchServiceImpl implements SearchService {
|
|
|
if (SearchUtils.isKeywordInvalid(keyword)) {
|
|
if (SearchUtils.isKeywordInvalid(keyword)) {
|
|
|
throw new IllegalArgumentException("搜索关键词无效:" + keyword);
|
|
throw new IllegalArgumentException("搜索关键词无效:" + keyword);
|
|
|
}
|
|
}
|
|
|
- // 现货卖家
|
|
|
|
|
Map<String, SPage<Object>> map = new HashMap<>();
|
|
Map<String, SPage<Object>> map = new HashMap<>();
|
|
|
- // 期货卖家
|
|
|
|
|
- BooleanQuery booleanQuery = new BooleanQuery();
|
|
|
|
|
|
|
+ BooleanQuery goodsQuery = new BooleanQuery();
|
|
|
|
|
+ BooleanQuery productsQuery = new BooleanQuery();
|
|
|
// TODO 卖家排序
|
|
// TODO 卖家排序
|
|
|
Sort sort = null;
|
|
Sort sort = null;
|
|
|
// 未指定搜索的字段,则采用默认搜索逻辑
|
|
// 未指定搜索的字段,则采用默认搜索逻辑
|
|
@@ -1667,23 +1666,24 @@ public class SearchServiceImpl implements SearchService {
|
|
|
} else {
|
|
} else {
|
|
|
goodsBooleanQuery.add(SearchUtils.getBooleanQuery(keywordField, keyword), BooleanClause.Occur.SHOULD);
|
|
goodsBooleanQuery.add(SearchUtils.getBooleanQuery(keywordField, keyword), BooleanClause.Occur.SHOULD);
|
|
|
}
|
|
}
|
|
|
- booleanQuery.add(goodsBooleanQuery, Occur.MUST);
|
|
|
|
|
- // 现货卖家
|
|
|
|
|
- map.put("stock", querySellers(SearchConstants.GOODS_TABLE_NAME, page, size, booleanQuery, sort, duplicate));
|
|
|
|
|
|
|
+ goodsQuery.add(goodsBooleanQuery, Occur.MUST);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 现货卖家
|
|
|
|
|
+ map.put("stock", querySellers(SearchConstants.GOODS_TABLE_NAME, page, size, goodsQuery, sort, duplicate));
|
|
|
|
|
+ logger.info(goodsQuery.toString());
|
|
|
|
|
|
|
|
BooleanQuery productsBooleanQuery = new BooleanQuery();
|
|
BooleanQuery productsBooleanQuery = new BooleanQuery();
|
|
|
for (String keywordField : keywordFields.get("products")) {
|
|
for (String keywordField : keywordFields.get("products")) {
|
|
|
if (!tokenized) {
|
|
if (!tokenized) {
|
|
|
productsBooleanQuery.add(new TermQuery(new Term(keywordField, keyword.toLowerCase())), BooleanClause.Occur.SHOULD);
|
|
productsBooleanQuery.add(new TermQuery(new Term(keywordField, keyword.toLowerCase())), BooleanClause.Occur.SHOULD);
|
|
|
} else {
|
|
} else {
|
|
|
- productsBooleanQuery.add(SearchUtils.getBooleanQuery(keywordField, keyword), BooleanClause.Occur.SHOULD);
|
|
|
|
|
|
|
+ productsBooleanQuery.add(SearchUtils.getBooleanQuery(keywordField, keyword.toLowerCase()), BooleanClause.Occur.SHOULD);
|
|
|
}
|
|
}
|
|
|
- booleanQuery.add(productsBooleanQuery, Occur.MUST);
|
|
|
|
|
- // 期货卖家
|
|
|
|
|
- map.put("futures", querySellers(SearchConstants.PRODUCTS_PRIVATE_TABLE_NAME, page, size, booleanQuery, sort, duplicate));
|
|
|
|
|
|
|
+ productsQuery.add(productsBooleanQuery, Occur.MUST);
|
|
|
}
|
|
}
|
|
|
- logger.info(booleanQuery.toString());
|
|
|
|
|
|
|
+ // 期货卖家
|
|
|
|
|
+ map.put("futures", querySellers(SearchConstants.PRODUCTS_PRIVATE_TABLE_NAME, page, size, productsQuery, sort, duplicate));
|
|
|
|
|
+ logger.info(productsQuery.toString());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return map;
|
|
return map;
|