|
|
@@ -825,7 +825,7 @@ public class SearchServiceImpl implements SearchService, InnerSearchService {
|
|
|
keywordFields.add(SearchConstants.GOODS_BR_NAME_CN_UNTOKENIZED_FIELD);
|
|
|
keywordFields.add(SearchConstants.GOODS_BR_NAME_EN_UNTOKENIZED_FIELD);
|
|
|
Map<String, Object> goodsIds = getGoodsIds(keyword, keywordFields, false, pageParams);
|
|
|
- if (CollectionUtils.isEmpty(goodsIds)
|
|
|
+ if (CollectionUtils.isEmpty(goodsIds) || goodsIds.get("componentIds") == null
|
|
|
|| JSONObject.parseArray(goodsIds.get("componentIds").toString()).isEmpty()) {
|
|
|
goodsIds = getGoodsIds(keyword, null, true, pageParams);
|
|
|
}
|
|
|
@@ -965,6 +965,10 @@ public class SearchServiceImpl implements SearchService, InnerSearchService {
|
|
|
if (pageParams.getPage() > 1) {// 不是第一页
|
|
|
TopDocs previousHits = indexSearcher.search(booleanQuery,
|
|
|
(pageParams.getPage() - 1) * pageParams.getSize(), sort, true, false);
|
|
|
+ int totalHits = previousHits.totalHits;
|
|
|
+ if ((pageParams.getPage() - 1) * pageParams.getSize() >= totalHits) {
|
|
|
+ return map;
|
|
|
+ }
|
|
|
ScoreDoc[] previousScoreDocs = previousHits.scoreDocs;
|
|
|
ScoreDoc after = previousScoreDocs[previousScoreDocs.length - 1];
|
|
|
hits = indexSearcher.searchAfter(after, booleanQuery, pageParams.getSize(), sort, true, false);
|