Skip to content

Commit

Permalink
[docs] full results on enter, fixes ray-project#24519 (ray-project#24722
Browse files Browse the repository at this point in the history
)

Signed-off-by: Max Pumperla <max.pumperla@googlemail.com>
  • Loading branch information
maxpumperla authored May 12, 2022
1 parent dae7842 commit 42e877d
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion doc/source/_static/js/docsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,26 @@ docsearch({
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 = "search.html?q=" + text;

searchForm.submit();
}
});

0 comments on commit 42e877d

Please sign in to comment.