Skip to content

Commit c400a42

Browse files
authored
Update search configs to return only community docs hits (#1488)
1 parent 2a81b07 commit c400a42

File tree

3 files changed

+8
-90
lines changed

3 files changed

+8
-90
lines changed

source/_static/js/instantSearch.js

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ window.addEventListener("DOMContentLoaded", () => {
33
const searchModalEl = document.getElementById("search");
44
const root = document.documentElement;
55

6-
// Get the current doc platform
7-
const activePlatform = document
8-
.getElementsByTagName("meta")
9-
["docsearch:platform"].getAttribute("content");
10-
116
// Set search page title
127
// TODO: Do the right way
138
const pageName = document
@@ -103,8 +98,8 @@ window.addEventListener("DOMContentLoaded", () => {
10398
initialUiState: {
10499
minio: {
105100
refinementList: {
106-
platform: [activePlatform],
107-
site: "docs"
101+
site: "docs",
102+
edition: "community",
108103
},
109104
},
110105
},
@@ -128,17 +123,6 @@ window.addEventListener("DOMContentLoaded", () => {
128123
if (query !== "") {
129124
// Make search modal active
130125
searchModalEl.classList.add("search--focused");
131-
132-
// Clear the filters and select the active platform
133-
setTimeout(() => {
134-
const activeFilterEl = document.querySelector(
135-
".search__filters__checkbox[value='" + activePlatform + "']"
136-
);
137-
138-
if (activeFilterEl && !activeFilterEl.checked) {
139-
activeFilterEl.click();
140-
}
141-
}, 50);
142126
} else {
143127
// Clear the filters
144128
clearRefinements();
@@ -201,7 +185,6 @@ window.addEventListener("DOMContentLoaded", () => {
201185
</i>
202186
<div class="search__hits__text">
203187
<div class="search__hits__title">${data._highlightResult.hierarchy.lvl1.value}</div>
204-
<div class="search__hits__platform">${data.platform}</div>
205188
</div>
206189
`;
207190
}
@@ -219,7 +202,6 @@ window.addEventListener("DOMContentLoaded", () => {
219202
<div class="search__hits__text">
220203
<div class="search__hits__title">${data._highlightResult.hierarchy.lvl2.value}</div>
221204
<div class="search__hits__label">
222-
<div class="search__hits__platform">${data.platform}</div>
223205
${data.hierarchy.lvl1}
224206
</div>
225207
</div>
@@ -239,7 +221,6 @@ window.addEventListener("DOMContentLoaded", () => {
239221
<div class="search__hits__text">
240222
<div class="search__hits__title">${data._highlightResult.hierarchy.lvl3.value}</div>
241223
<div class="search__hits__label">
242-
<div class="search__hits__platform">${data.platform}</div>
243224
${data.hierarchy.lvl1}
244225
</div>
245226
</div>
@@ -262,7 +243,6 @@ window.addEventListener("DOMContentLoaded", () => {
262243
data._snippetResult.content.value
263244
}</div>
264245
<div class="search__hits__label">
265-
<div class="search__hits__platform">${data.platform}</div>
266246
${data.hierarchy.lvl1}
267247
${
268248
data.hierarchy.lvl2
@@ -374,24 +354,9 @@ window.addEventListener("DOMContentLoaded", () => {
374354
if (e.key === "Enter") {
375355
const searchInputEl = document.querySelector(".search__input");
376356
if (searchInputEl.value && document.activeElement === searchInputEl) {
377-
var platform = "";
378357
var environment = location.hostname === "localhost" || location.hostname === "127.0.0.1" ? "dev" : "prod";
379358

380-
if (activePlatform === "k8s") {
381-
platform = "kubernetes/upstream";
382-
} else if (activePlatform === "openshift") {
383-
platform = "kubernetes/openshift";
384-
} else if (activePlatform === "eks") {
385-
platform = "kubernetes/eks";
386-
} else if (activePlatform === "gke") {
387-
platform = "kubernetes/gke";
388-
} else if (activePlatform === "aks") {
389-
platform = "kubernetes/aks";
390-
} else {
391-
platform = activePlatform;
392-
}
393-
394-
var pathname = environment === "dev" ? "/search.html" : `/docs/minio/${platform}/search.html`;
359+
var pathname = environment === "dev" ? "/search.html" : `/docs/minio/search.html`;
395360

396361
setTimeout(() => {
397362
window.location.pathname = pathname;

source/_static/scss/includes/_search.scss

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@
9898
&::placeholder {
9999
color: var(--text-muted-color);
100100
}
101+
102+
&:focus {
103+
border-color: darken($neutral-subtle, 5%);
104+
}
101105
}
102106

103107
.search__reset {
@@ -276,17 +280,10 @@
276280
vertical-align: middle;
277281
color: var(--text-muted-color);
278282
font-size: 0.65rem;
279-
/* display: flex;
280-
align-items: center; */
281283
line-height: 1;
282-
//margin-top: 0.35rem;
283284
min-height: 1rem;
284285
padding-bottom: 0.1rem;
285286

286-
.search__hits__platform {
287-
margin-top: 0.2rem;
288-
}
289-
290287
& > svg {
291288
height: 0.8rem;
292289
width: 0.8rem;
@@ -310,19 +307,6 @@
310307
place-content: center;
311308
}
312309

313-
.search__hits__platform {
314-
font-size: 0.65rem;
315-
color: var(--text-muted-color);
316-
line-height: 1;
317-
border: 1px solid var(--is-hit-platform-border-color);
318-
border-radius: $border-radius;
319-
padding: 0.1rem 0.2rem;
320-
width: fit-content;
321-
margin: 0.4rem 0.35rem 0 0;
322-
display: inline-block;
323-
}
324-
325-
326310
.search__hits--empty {
327311
margin: 0;
328312
padding: 0;
@@ -454,14 +438,6 @@
454438
margin-top: 1rem;
455439
}
456440

457-
.search__form {
458-
border: 1px solid var(--is-search-border-color);
459-
460-
&:focus-within {
461-
box-shadow: 0 0 0 3px var(--is-search-focus-box-shadow);
462-
}
463-
}
464-
465441
#search-powered-by {
466442
position: absolute;
467443
top: -2.25rem;
@@ -477,30 +453,6 @@
477453

478454
&:not(.ais-Hits--empty) {
479455
position: relative;
480-
481-
&:before {
482-
content: "Search Results";
483-
padding-left: 0.75rem;
484-
font-size: $font-size-sm;
485-
font-weight: $font-weight-medium;
486-
display: inline-block;
487-
background-color: var(--body-bg);
488-
position: relative;
489-
padding-right: 0.5rem;
490-
z-index: 2;
491-
padding-bottom: 0.5rem;
492-
}
493-
494-
&:after {
495-
content: "";
496-
height: 1px;
497-
position: absolute;
498-
top: 1rem;
499-
left: 0;
500-
width: 100%;
501-
z-index: 1;
502-
background-color: var(--theme-light-bg);
503-
}
504456
}
505457
}
506458

source/_templates/head.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!-- Algolia meta attrs -->
22
<meta name="docsearch:site" content="docs"/>
3+
<meta name="docsearch:edition" content="community"/>
34
<meta name="pagename" content="{{ pagename }}"/>
45

56
<!-- Preload fonts and scripts -->

0 commit comments

Comments
 (0)