mirror of
https://github.com/minio/docs.git
synced 2025-08-08 01:43:18 +03:00
Replace Algolia DocSearch with InstantSearch (#621)
- Rendered only the relevant search results that has the match-level of either `full` or `partial`. - Added refinements to display results from other platforms (Active platform is selected by default). - Better title and hierarchical display.  - Added icons to represent the hierarchy level.  - Relevant results on full/partial match queries. <img width="595" alt="Screenshot 2022-10-27 at 12 09 26" src="https://user-images.githubusercontent.com/13393018/198228440-3a7b52a6-9f33-4778-a2ab-15b1454ede99.png"> - TODO: Keyboard shortcut to trigger/focus the search modal. (Will address this with a new PR)
This commit is contained in:
@@ -350,39 +350,6 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
||||
}
|
||||
})();
|
||||
|
||||
// --------------------------------------------------
|
||||
// Search
|
||||
// --------------------------------------------------
|
||||
(function () {
|
||||
const docSearchEl = document.getElementById("docsearch");
|
||||
const platform = document.head.querySelector('meta[name="docsearch:platform"]').content
|
||||
|
||||
if(docSearchEl) {
|
||||
// Init Docsearch
|
||||
docsearch({
|
||||
container: '#docsearch',
|
||||
appId: 'E1CSOK3UC2',
|
||||
indexName: 'minio',
|
||||
apiKey: '6bc246d81fd3b79f51cf88f0b2481bac',
|
||||
placeholder: 'Search Documentation',
|
||||
searchParameters: {
|
||||
facetFilters: ['platform:' + platform]
|
||||
}
|
||||
});
|
||||
|
||||
// Trigger Docsearch modal on custom button clicks
|
||||
const searchToggleEls = document.querySelectorAll(".search-toggle");
|
||||
const docSearchBtn = document.querySelector(".DocSearch-Button");
|
||||
|
||||
searchToggleEls.forEach(item => {
|
||||
item.addEventListener("click", (event) => {
|
||||
event.preventDefault();
|
||||
docSearchBtn.click();
|
||||
});
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
// --------------------------------------------------
|
||||
// Custom scrollbars for `pre` code blocks
|
||||
// --------------------------------------------------
|
||||
|
Reference in New Issue
Block a user