Browse Source

fix: Compatible with special characters in pg full-text search. (#8921)

Co-authored-by: Aurelius Huang <cm.huang@aftership.com>
tags/0.9.0
Aurelius Huang 1 year ago
parent
commit
4585cffce1
No account linked to committer's email address
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      api/core/rag/datasource/vdb/pgvector/pgvector.py

+ 1
- 1
api/core/rag/datasource/vdb/pgvector/pgvector.py View File

@@ -166,7 +166,7 @@ class PGVector(BaseVector):

with self._get_cursor() as cur:
cur.execute(
f"""SELECT meta, text, ts_rank(to_tsvector(coalesce(text, '')), to_tsquery(%s)) AS score
f"""SELECT meta, text, ts_rank(to_tsvector(coalesce(text, '')), plainto_tsquery(%s)) AS score
FROM {self.table_name}
WHERE to_tsvector(text) @@ plainto_tsquery(%s)
ORDER BY score DESC

Loading…
Cancel
Save