Check each word individually in markets search
This commit is contained in:
parent
71faee584c
commit
415bd4990a
|
@ -205,9 +205,11 @@ export function SearchableGrid(props: {
|
||||||
}) {
|
}) {
|
||||||
const { contracts, query, setQuery, sort, setSort, byOneCreator } = props
|
const { contracts, query, setQuery, sort, setSort, byOneCreator } = props
|
||||||
|
|
||||||
|
const queryWords = query.toLowerCase().split(' ')
|
||||||
function check(corpus: String) {
|
function check(corpus: String) {
|
||||||
return corpus.toLowerCase().includes(query.toLowerCase())
|
return queryWords.every((word) => corpus.toLowerCase().includes(word))
|
||||||
}
|
}
|
||||||
|
|
||||||
let matches = contracts.filter(
|
let matches = contracts.filter(
|
||||||
(c) =>
|
(c) =>
|
||||||
check(c.question) ||
|
check(c.question) ||
|
||||||
|
|
Loading…
Reference in New Issue
Block a user