Browse Source

feat:es语句调整

fuwencai 8 tháng trước cách đây
mục cha
commit
9bed621e7d
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      rpc/knowledge/util/elasticsearch_dsl.go

+ 1 - 1
rpc/knowledge/util/elasticsearch_dsl.go

@@ -93,7 +93,7 @@ func GetQueryOT(tags, question, keywords, repositoryId string) (qstr string) {
 	return qstr
 }
 
-var queryStr = `{"_source": ["question","intention","answer"],"size": %d, "min_score":%v,"query": {"bool": {"must": [{"script_score": {"query": {"term":{"entId":%v}},"script": {"source": "cosineSimilarity(params.queryVector,'questionVector')+1", "params": {"queryVector": %v}}}}]}}}`
+var queryStr = `{"_source": ["question","intention","answer"],"size": %d, "min_score":%v,"query": {"bool": {"must": [{"script_score": {"query": {"term":{"entId":%v}},"script": {"source": "cosine(params.queryVector,doc['questionVector'])+1", "params": {"queryVector": %v}}}}]}}}`
 
 func GetAnswerQueryStr(question string, entId string, size int, minScore float64) string {
 	qv, _ := EncodeVector(question)