Skip to content

Commit

Permalink
docs: search by version in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Dec 23, 2022
1 parent ad2446c commit a4bd7cc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ for (var i = 0; i < pairs.length; ++i) {
}
}

var versionFromUrl = window.location.pathname.match(/^\/docs\/(\d+\.x)/);
var version = versionFromUrl ? versionFromUrl[1] : '6.x';

if (q != null) {
document.getElementById('search-input').value = decodeURIComponent(q);
fetch(root + '/search?search=' + q).
fetch(root + '/search?search=' + q + '&version=' + version).
then(function(res) { return res.json(); }).
then(
function(result) {
Expand Down

0 comments on commit a4bd7cc

Please sign in to comment.