Skip to content

Commit

Permalink
Merge pull request #12830 from Automattic/vkarpov15/gh-12548
Browse files Browse the repository at this point in the history
Search content by version
  • Loading branch information
vkarpov15 committed Dec 27, 2022
2 parents 2796185 + 1c6cb93 commit e3472fa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/js/search.js
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 e3472fa

Please sign in to comment.