From 4262411b5808575ef1e5f3d31d08e702bba72a90 Mon Sep 17 00:00:00 2001 From: Piotr Rogowski Date: Sun, 30 Oct 2022 14:31:12 +0100 Subject: [PATCH] Allow searching author, closes #802 --- src/hooks/useDb.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/useDb.ts b/src/hooks/useDb.ts index 7bc622b..0abe2e1 100644 --- a/src/hooks/useDb.ts +++ b/src/hooks/useDb.ts @@ -92,10 +92,10 @@ const useDb = () => { }; const searchTunes = async (search: string, page: number, perPage: number) => { - const phrases = search.length > 0 ? search.replace(/ +(?= )/g,'').split(' ') : []; + const phrases = search.length > 0 ? search.replace(/ +(?= )/g, '').split(' ') : []; const filter = phrases .filter((phrase) => phrase.length > 1) - .map((phrase) => `textSearch ~ "${phrase}"`) + .map((phrase) => `textSearch ~ "${phrase}" || author.username ~ "${phrase}"`) .join(' && '); try {