Fix the issue of repeated escaping of quotes in hit test (#13477)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
import threading
|
||||
from typing import Optional
|
||||
|
||||
@@ -171,7 +172,7 @@ class RetrievalService:
|
||||
vector = Vector(dataset=dataset)
|
||||
|
||||
documents = vector.search_by_vector(
|
||||
cls.escape_query_for_search(query),
|
||||
query,
|
||||
search_type="similarity_score_threshold",
|
||||
top_k=top_k,
|
||||
score_threshold=score_threshold,
|
||||
@@ -250,7 +251,7 @@ class RetrievalService:
|
||||
|
||||
@staticmethod
|
||||
def escape_query_for_search(query: str) -> str:
|
||||
return query.replace('"', '\\"')
|
||||
return json.dumps(query).strip('"')
|
||||
|
||||
@staticmethod
|
||||
def format_retrieval_documents(documents: list[Document]) -> list[RetrievalSegments]:
|
||||
|
Reference in New Issue
Block a user