From 69e43ddb19cd0f55a6f5a2a1578684e99022d55f Mon Sep 17 00:00:00 2001 From: raphaelgurtner Date: Fri, 14 Nov 2025 13:04:49 +0100 Subject: [PATCH] use websearch_to_tsquery + regexp_replace for ts-query creation produces ts queries with logical OR instead of logical AND --- langchain_postgres/v2/async_vectorstore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain_postgres/v2/async_vectorstore.py b/langchain_postgres/v2/async_vectorstore.py index c83930e..fce62bc 100644 --- a/langchain_postgres/v2/async_vectorstore.py +++ b/langchain_postgres/v2/async_vectorstore.py @@ -650,7 +650,7 @@ async def __query_collection( if hybrid_search_config.tsv_lang else "" ) - query_tsv = f"plainto_tsquery({lang} :fts_query)" + query_tsv = fr"websearch_to_tsquery({lang} regexp_replace(:fts_query, '\s', ' OR ', 'g'))" param_dict["fts_query"] = fts_query if hybrid_search_config.tsv_column: content_tsv = f'"{hybrid_search_config.tsv_column}"'