From 415bd4990aaea2d011f65b3c5d31bd3a8f3116c7 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Mon, 28 Feb 2022 17:52:41 -0800 Subject: [PATCH] Check each word individually in markets search --- web/components/contracts-list.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/components/contracts-list.tsx b/web/components/contracts-list.tsx index 6fc49780..911e546e 100644 --- a/web/components/contracts-list.tsx +++ b/web/components/contracts-list.tsx @@ -205,9 +205,11 @@ export function SearchableGrid(props: { }) { const { contracts, query, setQuery, sort, setSort, byOneCreator } = props + const queryWords = query.toLowerCase().split(' ') function check(corpus: String) { - return corpus.toLowerCase().includes(query.toLowerCase()) + return queryWords.every((word) => corpus.toLowerCase().includes(word)) } + let matches = contracts.filter( (c) => check(c.question) ||