mirror of
https://github.com/healthchecks/healthchecks.git
synced 2025-04-10 15:37:30 +00:00

The trigram tokenizer seems to give better results, but is not available on the SQLite version that ships with Ubuntu 20.04.
27 lines
No EOL
771 B
JavaScript
27 lines
No EOL
771 B
JavaScript
$(function() {
|
|
var base = document.getElementById("base-url").getAttribute("href").slice(0, -1);
|
|
var input = $("#docs-search");
|
|
|
|
input.on("keyup focus", function() {
|
|
var q = this.value;
|
|
if (q.length < 3) {
|
|
$("#search-results").removeClass("on");
|
|
$("#docs-nav").removeClass("off");
|
|
return
|
|
}
|
|
|
|
$.ajax({
|
|
url: base + "/docs/search/",
|
|
type: "get",
|
|
data: {q: q},
|
|
success: function(data) {
|
|
if (q != input.val()) {
|
|
return; // ignore stale results
|
|
}
|
|
|
|
$("#search-results").html(data).addClass("on");
|
|
$("#docs-nav").addClass("off");
|
|
}
|
|
});
|
|
});
|
|
}); |