Skip to content

Commit daa0c68

Browse files
committed
Trim full text filters
1 parent ed941f5 commit daa0c68

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/core/database/query/filters.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,19 @@ export const fullText =
257257
matchToNode: (query: Query) => Query;
258258
}) =>
259259
<T, K extends ConditionalKeys<T, string | undefined>>({
260-
value,
260+
value: raw,
261261
key: field,
262262
query,
263263
}: BuilderArgs<T, K>) => {
264-
if (!value || typeof value !== 'string') {
264+
if (!raw || typeof raw !== 'string') {
265+
return null;
266+
}
267+
const value = (raw as string).trim();
268+
if (!value) {
265269
return null;
266270
}
267271

268-
const normalized = normalizeInput
269-
? normalizeInput(value as string)
270-
: (value as string);
272+
const normalized = normalizeInput ? normalizeInput(value) : value;
271273

272274
let input = separateQueryForEachWord
273275
? cleanSplit(normalized, ' ')

0 commit comments

Comments
 (0)