修改README

This commit is contained in:
2026-01-13 11:29:14 +08:00
parent e5ac2dde03
commit 36bc0cc08b
2 changed files with 33 additions and 9 deletions

View File

@@ -102,10 +102,10 @@ class DataService:
results = []
with self.db.engine.connect() as conn:
keyword_query = func.websearch_to_tsquery('english', query_text)
vector_score = (1 - self.db.chunks.c.embedding.cosine_distance(query_vector))
keyword_score = func.ts_rank(self.db.chunks.c.content_tsvector, keyword_query)
final_score = (vector_score * 0.7 + func.coalesce(keyword_score, 0) * 0.3).label("score")
keyword_query = func.websearch_to_tsquery('english', query_text) # 转换为 tsquery
vector_score = (1 - self.db.chunks.c.embedding.cosine_distance(query_vector))# 计算向量相似度
keyword_score = func.ts_rank(self.db.chunks.c.content_tsvector, keyword_query) # 计算关键词相似度
final_score = (vector_score * 0.7 + func.coalesce(keyword_score, 0) * 0.3).label("score")# 计算最终分数
stmt = select(
self.db.chunks.c.task_id,