1
0
mirror of https://github.com/minio/docs.git synced 2025-08-08 01:43:18 +03:00

Update search configs to return only community docs hits (#1488)

This commit is contained in:
Rushan
2025-07-31 18:48:35 +05:30
committed by GitHub
parent 2a81b07c24
commit c400a42221
3 changed files with 8 additions and 90 deletions

View File

@@ -3,11 +3,6 @@ window.addEventListener("DOMContentLoaded", () => {
const searchModalEl = document.getElementById("search"); const searchModalEl = document.getElementById("search");
const root = document.documentElement; const root = document.documentElement;
// Get the current doc platform
const activePlatform = document
.getElementsByTagName("meta")
["docsearch:platform"].getAttribute("content");
// Set search page title // Set search page title
// TODO: Do the right way // TODO: Do the right way
const pageName = document const pageName = document
@@ -103,8 +98,8 @@ window.addEventListener("DOMContentLoaded", () => {
initialUiState: { initialUiState: {
minio: { minio: {
refinementList: { refinementList: {
platform: [activePlatform], site: "docs",
site: "docs" edition: "community",
}, },
}, },
}, },
@@ -128,17 +123,6 @@ window.addEventListener("DOMContentLoaded", () => {
if (query !== "") { if (query !== "") {
// Make search modal active // Make search modal active
searchModalEl.classList.add("search--focused"); searchModalEl.classList.add("search--focused");
// Clear the filters and select the active platform
setTimeout(() => {
const activeFilterEl = document.querySelector(
".search__filters__checkbox[value='" + activePlatform + "']"
);
if (activeFilterEl && !activeFilterEl.checked) {
activeFilterEl.click();
}
}, 50);
} else { } else {
// Clear the filters // Clear the filters
clearRefinements(); clearRefinements();
@@ -201,7 +185,6 @@ window.addEventListener("DOMContentLoaded", () => {
</i> </i>
<div class="search__hits__text"> <div class="search__hits__text">
<div class="search__hits__title">${data._highlightResult.hierarchy.lvl1.value}</div> <div class="search__hits__title">${data._highlightResult.hierarchy.lvl1.value}</div>
<div class="search__hits__platform">${data.platform}</div>
</div> </div>
`; `;
} }
@@ -219,7 +202,6 @@ window.addEventListener("DOMContentLoaded", () => {
<div class="search__hits__text"> <div class="search__hits__text">
<div class="search__hits__title">${data._highlightResult.hierarchy.lvl2.value}</div> <div class="search__hits__title">${data._highlightResult.hierarchy.lvl2.value}</div>
<div class="search__hits__label"> <div class="search__hits__label">
<div class="search__hits__platform">${data.platform}</div>
${data.hierarchy.lvl1} ${data.hierarchy.lvl1}
</div> </div>
</div> </div>
@@ -239,7 +221,6 @@ window.addEventListener("DOMContentLoaded", () => {
<div class="search__hits__text"> <div class="search__hits__text">
<div class="search__hits__title">${data._highlightResult.hierarchy.lvl3.value}</div> <div class="search__hits__title">${data._highlightResult.hierarchy.lvl3.value}</div>
<div class="search__hits__label"> <div class="search__hits__label">
<div class="search__hits__platform">${data.platform}</div>
${data.hierarchy.lvl1} ${data.hierarchy.lvl1}
</div> </div>
</div> </div>
@@ -262,7 +243,6 @@ window.addEventListener("DOMContentLoaded", () => {
data._snippetResult.content.value data._snippetResult.content.value
}</div> }</div>
<div class="search__hits__label"> <div class="search__hits__label">
<div class="search__hits__platform">${data.platform}</div>
${data.hierarchy.lvl1} ${data.hierarchy.lvl1}
${ ${
data.hierarchy.lvl2 data.hierarchy.lvl2
@@ -374,24 +354,9 @@ window.addEventListener("DOMContentLoaded", () => {
if (e.key === "Enter") { if (e.key === "Enter") {
const searchInputEl = document.querySelector(".search__input"); const searchInputEl = document.querySelector(".search__input");
if (searchInputEl.value && document.activeElement === searchInputEl) { if (searchInputEl.value && document.activeElement === searchInputEl) {
var platform = "";
var environment = location.hostname === "localhost" || location.hostname === "127.0.0.1" ? "dev" : "prod"; var environment = location.hostname === "localhost" || location.hostname === "127.0.0.1" ? "dev" : "prod";
if (activePlatform === "k8s") { var pathname = environment === "dev" ? "/search.html" : `/docs/minio/search.html`;
platform = "kubernetes/upstream";
} else if (activePlatform === "openshift") {
platform = "kubernetes/openshift";
} else if (activePlatform === "eks") {
platform = "kubernetes/eks";
} else if (activePlatform === "gke") {
platform = "kubernetes/gke";
} else if (activePlatform === "aks") {
platform = "kubernetes/aks";
} else {
platform = activePlatform;
}
var pathname = environment === "dev" ? "/search.html" : `/docs/minio/${platform}/search.html`;
setTimeout(() => { setTimeout(() => {
window.location.pathname = pathname; window.location.pathname = pathname;

View File

@@ -98,6 +98,10 @@
&::placeholder { &::placeholder {
color: var(--text-muted-color); color: var(--text-muted-color);
} }
&:focus {
border-color: darken($neutral-subtle, 5%);
}
} }
.search__reset { .search__reset {
@@ -276,17 +280,10 @@
vertical-align: middle; vertical-align: middle;
color: var(--text-muted-color); color: var(--text-muted-color);
font-size: 0.65rem; font-size: 0.65rem;
/* display: flex;
align-items: center; */
line-height: 1; line-height: 1;
//margin-top: 0.35rem;
min-height: 1rem; min-height: 1rem;
padding-bottom: 0.1rem; padding-bottom: 0.1rem;
.search__hits__platform {
margin-top: 0.2rem;
}
& > svg { & > svg {
height: 0.8rem; height: 0.8rem;
width: 0.8rem; width: 0.8rem;
@@ -310,19 +307,6 @@
place-content: center; place-content: center;
} }
.search__hits__platform {
font-size: 0.65rem;
color: var(--text-muted-color);
line-height: 1;
border: 1px solid var(--is-hit-platform-border-color);
border-radius: $border-radius;
padding: 0.1rem 0.2rem;
width: fit-content;
margin: 0.4rem 0.35rem 0 0;
display: inline-block;
}
.search__hits--empty { .search__hits--empty {
margin: 0; margin: 0;
padding: 0; padding: 0;
@@ -454,14 +438,6 @@
margin-top: 1rem; margin-top: 1rem;
} }
.search__form {
border: 1px solid var(--is-search-border-color);
&:focus-within {
box-shadow: 0 0 0 3px var(--is-search-focus-box-shadow);
}
}
#search-powered-by { #search-powered-by {
position: absolute; position: absolute;
top: -2.25rem; top: -2.25rem;
@@ -477,30 +453,6 @@
&:not(.ais-Hits--empty) { &:not(.ais-Hits--empty) {
position: relative; position: relative;
&:before {
content: "Search Results";
padding-left: 0.75rem;
font-size: $font-size-sm;
font-weight: $font-weight-medium;
display: inline-block;
background-color: var(--body-bg);
position: relative;
padding-right: 0.5rem;
z-index: 2;
padding-bottom: 0.5rem;
}
&:after {
content: "";
height: 1px;
position: absolute;
top: 1rem;
left: 0;
width: 100%;
z-index: 1;
background-color: var(--theme-light-bg);
}
} }
} }

View File

@@ -1,5 +1,6 @@
<!-- Algolia meta attrs --> <!-- Algolia meta attrs -->
<meta name="docsearch:site" content="docs"/> <meta name="docsearch:site" content="docs"/>
<meta name="docsearch:edition" content="community"/>
<meta name="pagename" content="{{ pagename }}"/> <meta name="pagename" content="{{ pagename }}"/>
<!-- Preload fonts and scripts --> <!-- Preload fonts and scripts -->