Можно так
<form id="search">
<input type="search" name="search">
<button type="submit">OK</button>
</form>
window.onload = function() {
document.getElementById('search').addEventListener('submit', function(e) {
e.preventDefault();
let s = this.search.value;
location.href = "?search=" + s;
});
};