ray/doc/source/_static/js/docsearch.js
Max Pumperla ac850055bf
use absolute url for search, fixes #24808 (#24877)
Signed-off-by: Max Pumperla <max.pumperla@googlemail.com>
2022-05-17 13:22:53 +01:00

29 lines
899 B
JavaScript

docsearch({
apiKey: '6c42f30d9669d8e42f6fc92f44028596',
indexName: 'docs-ray',
appId: 'LBHF0PABBL',
inputSelector: '#search-input',
debug: false,
algoliaOptions: {
hitsPerPage: 10,
},
handleSelected: function (input, event, suggestion, datasetNumber, context) {
if (context.selectionMethod === 'click') {
input.setVal('');
const windowReference = window.open(suggestion.url, "_self");
windowReference.focus();
}
}
});
const searchInput = document.getElementById("search-input");
searchInput.addEventListener("keydown", function (e) {
if (e.code === "Enter") {
var searchForm = document.getElementsByClassName("bd-search")[0];
const text = searchInput.value;
searchForm.action = "https://docs.ray.io/en/latest/search.html?q=" + text;
searchForm.submit();
}
});