From 55b24bb3c4b508327d8cb8b01a8239c4c99407b9 Mon Sep 17 00:00:00 2001 From: Gon Pombo Date: Mon, 11 Nov 2024 18:21:43 -0300 Subject: [PATCH] remove sdk6 search results (#16) --- assets/search.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/assets/search.js b/assets/search.js index 7eee5b2..aba240b 100644 --- a/assets/search.js +++ b/assets/search.js @@ -113,15 +113,24 @@ if (hits.length) return hits return window.lunrIdx.search(searchValue(true)).slice(0, LIMIT_RESULTS); } + const currentPathname = window.location.pathname const searchHits = getSearchHits() + + const filterSDK6 = isSdk6(currentPathname) ? searchHits : searchHits.filter($ => { + const document = documents.get(Number($.ref)) + if (!document || isSdk6(document.href)) return false + return true + }) + showSearchBox() - if (!searchHits.length) { + + if (!filterSDK6.length) { resultCard(`Not Found`, `Sorry, we couldn't find any matches. Try searching for a different keyword`) return } - const currentPathname = window.location.pathname - searchHits.forEach((hit) => { + + filterSDK6.forEach((hit) => { const document = documents.get(Number(hit.ref)) if (!document) return if ((isSdk6(currentPathname) && isSdk7(document.href))