Authored by wangnan

Merge branch 'wn_robot_removedefaultquestion' into 0118

... ... @@ -14,7 +14,6 @@ import com.yoho.search.service.servicenew.IRobotQuestionService;
import com.yoho.search.service.utils.HttpServletRequestUtils;
import com.yoho.search.service.utils.SearchApiResultUtils;
import com.yoho.search.service.vo.SearchApiResult;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.MatchQueryBuilder;
... ... @@ -126,22 +125,21 @@ public class RobotQuestionServiceImpl extends BaseService implements IRobotQuest
if (searchResult == null) {
return searchApiResult.setCode(500);
}
//8.如果结果为空,返回默认的一条结果
if (CollectionUtils.isEmpty(searchResult.getResultList())) {
JSONObject dataMap = new JSONObject();
dataMap.put("total", 1);
dataMap.put("page", 1);
dataMap.put("page_size", 1);
dataMap.put("page_total", 1);
Map<String, Object> productMap = new LinkedHashMap<>();
productMap.put("question", "default question");
productMap.put("answer", "我不太理解您的意思,您可以点击人工客服,联系我们萌萌哒客服妹纸处理问题哦~");
List<Map<String, Object>> pageList = new ArrayList<Map<String, Object>>();
pageList.add(productMap);
dataMap.put("answer_list", pageList);
return new SearchApiResult().setData(dataMap);
}
// if (CollectionUtils.isEmpty(searchResult.getResultList())) {
// JSONObject dataMap = new JSONObject();
// dataMap.put("total", 1);
// dataMap.put("page", 1);
// dataMap.put("page_size", 1);
// dataMap.put("page_total", 1);
// Map<String, Object> productMap = new LinkedHashMap<>();
// productMap.put("question", "default question");
// productMap.put("answer", "我不太理解您的意思,您可以点击人工客服,联系我们萌萌哒客服妹纸处理问题哦~");
// List<Map<String, Object>> pageList = new ArrayList<Map<String, Object>>();
// pageList.add(productMap);
// dataMap.put("answer_list", pageList);
// return new SearchApiResult().setData(dataMap);
// }
// 9.构造返回结果并加入缓存
JSONObject dataMap = new JSONObject();
... ...