mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
fix: Compatible with special characters in pg full-text search. (#8921)
Co-authored-by: Aurelius Huang <cm.huang@aftership.com>
This commit is contained in:
parent
13046709a9
commit
4585cffce1
|
@ -166,7 +166,7 @@ class PGVector(BaseVector):
|
||||||
|
|
||||||
with self._get_cursor() as cur:
|
with self._get_cursor() as cur:
|
||||||
cur.execute(
|
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}
|
FROM {self.table_name}
|
||||||
WHERE to_tsvector(text) @@ plainto_tsquery(%s)
|
WHERE to_tsvector(text) @@ plainto_tsquery(%s)
|
||||||
ORDER BY score DESC
|
ORDER BY score DESC
|
||||||
|
|
Loading…
Reference in New Issue
Block a user