From 72723821d30c37bec8ce959ca3d33eb8d0a4c04b Mon Sep 17 00:00:00 2001 From: Kat Hagan Date: Fri, 3 Jul 2020 00:14:49 -0700 Subject: [PATCH 1/3] search should be case insensitive --- lib/search/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/search/index.ts b/lib/search/index.ts index 78675fc5c..6094573b9 100644 --- a/lib/search/index.ts +++ b/lib/search/index.ts @@ -203,7 +203,7 @@ export const middleware: S.Middleware = (store) => { if ( searchTerms.length > 0 && - !searchTerms.every((term) => note.content.includes(term)) + !searchTerms.every((term) => note.content.match(RegExp(term, 'gi'))) ) { continue; } From c93c6cebbbea9bdad9d6f797ab6e308d62bca3cd Mon Sep 17 00:00:00 2001 From: Kat Hagan Date: Fri, 3 Jul 2020 00:33:05 -0700 Subject: [PATCH 2/3] fix missing search results due to column alignment --- lib/note-list/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/note-list/index.tsx b/lib/note-list/index.tsx index d16c9fe44..ec0b20cb3 100644 --- a/lib/note-list/index.tsx +++ b/lib/note-list/index.tsx @@ -91,7 +91,7 @@ const renderNote = ( ) : ( Date: Mon, 6 Jul 2020 11:14:00 -0700 Subject: [PATCH 3/3] lowercase term instead of regex --- lib/search/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/search/index.ts b/lib/search/index.ts index 6094573b9..2b5ec2c9c 100644 --- a/lib/search/index.ts +++ b/lib/search/index.ts @@ -203,7 +203,9 @@ export const middleware: S.Middleware = (store) => { if ( searchTerms.length > 0 && - !searchTerms.every((term) => note.content.match(RegExp(term, 'gi'))) + !searchTerms.every((term) => + note.content.includes(term.toLocaleLowerCase()) + ) ) { continue; }