pull/552/head
Cory LaViska 2021-09-30 08:07:15 -04:00
rodzic f8fa29f157
commit c83581cf47
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -221,7 +221,12 @@
await searchIndex;
const hasQuery = query.length > 0;
const matches = hasQuery ? searchIndex.search(`${query}~2`) : [];
let matches = hasQuery ? searchIndex.search(`${query}`) : [];
// Fall back to a fuzzy search if no matches are found
if (matches.length === 0 && hasQuery) {
matches = searchIndex.search(`${query}~2`);
}
let hasResults = hasQuery && matches.length > 0;
siteSearch.classList.toggle('site-search--has-results', hasQuery && hasResults);