From 087bb60b316ff71fc8adbd8acd8f74d9ddb0664a Mon Sep 17 00:00:00 2001 From: kenwoodjw Date: Wed, 12 Mar 2025 18:34:42 +0800 Subject: [PATCH] fix: preserve Unicode characters in keyword search queries (#15522) Signed-off-by: kenwoodjw --- api/core/rag/datasource/retrieval_service.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/core/rag/datasource/retrieval_service.py b/api/core/rag/datasource/retrieval_service.py index bd0996c9c6..0bcfa3098d 100644 --- a/api/core/rag/datasource/retrieval_service.py +++ b/api/core/rag/datasource/retrieval_service.py @@ -1,5 +1,4 @@ import concurrent.futures -import json from concurrent.futures import ThreadPoolExecutor from typing import Optional @@ -243,7 +242,7 @@ class RetrievalService: @staticmethod def escape_query_for_search(query: str) -> str: - return json.dumps(query).strip('"') + return query.replace('"', '\\"') @classmethod def format_retrieval_documents(cls, documents: list[Document]) -> list[RetrievalSegments]: