mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2025-07-16 11:41:27 +00:00
remove sdk6 search results (#16)
This commit is contained in:
parent
02486e76a2
commit
55b24bb3c4
@ -113,15 +113,24 @@
|
|||||||
if (hits.length) return hits
|
if (hits.length) return hits
|
||||||
return window.lunrIdx.search(searchValue(true)).slice(0, LIMIT_RESULTS);
|
return window.lunrIdx.search(searchValue(true)).slice(0, LIMIT_RESULTS);
|
||||||
}
|
}
|
||||||
|
const currentPathname = window.location.pathname
|
||||||
const searchHits = getSearchHits()
|
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()
|
showSearchBox()
|
||||||
if (!searchHits.length) {
|
|
||||||
|
if (!filterSDK6.length) {
|
||||||
resultCard(`Not Found`, `Sorry, we couldn't find any matches. Try searching for a different keyword`)
|
resultCard(`Not Found`, `Sorry, we couldn't find any matches. Try searching for a different keyword`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const currentPathname = window.location.pathname
|
|
||||||
|
|
||||||
searchHits.forEach((hit) => {
|
|
||||||
|
filterSDK6.forEach((hit) => {
|
||||||
const document = documents.get(Number(hit.ref))
|
const document = documents.get(Number(hit.ref))
|
||||||
if (!document) return
|
if (!document) return
|
||||||
if ((isSdk6(currentPathname) && isSdk7(document.href))
|
if ((isSdk6(currentPathname) && isSdk7(document.href))
|
||||||
|
Loading…
Reference in New Issue
Block a user