瀏覽代碼

feat:es语句调整

fuwencai 8 月之前
父節點
當前提交
9bed621e7d
共有 1 個文件被更改,包括 1 次插入1 次删除
  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)