Skip to content

Commit 8fa9ed2

Browse files
committed
fix: contains filter for question search
1 parent a8ffd26 commit 8fa9ed2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

plugins/qeta-backend/src/database/DatabaseQetaStore.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,12 @@ export class DatabaseQetaStore implements QetaStore {
102102
if (options.searchQuery) {
103103
if (this.db.client.config.client === 'pg') {
104104
query.whereRaw(
105-
`to_tsvector('english', questions.title || ' ' || questions.content) @@ websearch_to_tsquery('english', ?)`,
106-
[`${options.searchQuery}`],
105+
`(to_tsvector('english', questions.title || ' ' || questions.content) @@ websearch_to_tsquery('english', ?)
106+
or to_tsvector('english', questions.title || ' ' || questions.content) @@ to_tsquery('english',?))`,
107+
[
108+
`${options.searchQuery}`,
109+
`${options.searchQuery.replaceAll(/\s/g, '+')}:*`,
110+
],
107111
);
108112
} else {
109113
query.whereRaw(

0 commit comments

Comments
 (0)