Browse Source

feat:A24176调整

fuwencai 8 months ago
parent
commit
798fe9f4f2
1 changed files with 18 additions and 14 deletions
  1. 18 14
      rpc/knowledge/internal/service/knowledgeService.go

+ 18 - 14
rpc/knowledge/internal/service/knowledgeService.go

@@ -309,24 +309,28 @@ func (k *KnowledgeService) RecommendAnswer(param *knowledgeclient.FindAnswerReq,
 		searchField = `"answer","question"`
 		answers     []*knowledgeclient.Question
 	)
-	//根据问题进行分词
-	keywordsArr := util.HanlpGetNormalWords(param.Question, segment)
-	logx.Info("keywordsArr", keywordsArr)
-	if len(keywordsArr) != 0 {
-		for _, val := range keywordsArr {
-			keyWords += val + " "
-		}
-	}
-	if keyWords == "" {
-		keyWords = param.Question
-	}
-	//logx.Info("entId:", SE.Decode4Hex(param.RobotEntId))
-	var query = util.DSL4SearchByKwsOrid(keyWords, param.RobotEntId, 0)
+	robotEntId := SE.Decode4Hex(param.RobotEntId)
+	////根据问题进行分词
+	//keywordsArr := util.HanlpGetNormalWords(param.Question, segment)
+	//logx.Info("keywordsArr", keywordsArr)
+	//if len(keywordsArr) != 0 {
+	//	for _, val := range keywordsArr {
+	//		keyWords += val + " "
+	//	}
+	//}
+	//if keyWords == "" {
+	//	keyWords = param.Question
+	//}
+	////logx.Info("entId:", SE.Decode4Hex(param.RobotEntId))
+	//var query = util.DSL4SearchByKwsOrid(keyWords, param.RobotEntId, 0)
 	limit := 3
 	if param.ReqSource == 1 {
 		limit = recommendQuestionCount
 	}
-	res := elastic.GetAllByNgram(Index, Type, query, "", "", searchField, 0, limit, 0, false)
+	//res := elastic.GetAllByNgram(Index, Type, query, "", "", searchField, 0, limit, 0, false)
+	query := util.GetAnswerQueryStr(param.Question, robotEntId, limit, init.C.MinScore)
+	logx.Info("query:", query)
+	res := ESV7.Get(ESV7Index, ESV7Type, query)
 	if res != nil && len(*res) > 0 {
 		for _, val := range *res {
 			answers = append(answers, &knowledgeclient.Question{