summaryrefslogtreecommitdiff
path: root/search.html
diff options
context:
space:
mode:
authoruvok cheetah2020-05-23 15:28:35 +0200
committeruvok cheetah2020-05-23 15:28:35 +0200
commit3b06f54bdf699082aed6c4f2ad4d77f6338731c7 (patch)
tree0e792320f6764f9527370ce4dd1cfa3c0f9df30f /search.html
parent19d0278400cbe1459b95554a1d0e616e13d3d485 (diff)
Use Array.prototype.find
Diffstat (limited to 'search.html')
-rw-r--r--search.html4
1 files changed, 3 insertions, 1 deletions
diff --git a/search.html b/search.html
index fb31595..001facd 100644
--- a/search.html
+++ b/search.html
@@ -42,11 +42,13 @@ layout: page
result.forEach(r => {
- var p = pages.filter(p => p.id == r.ref)[0];
+ const p = pages.find(p => p.id == r.ref);
var li = document.createElement("li")
var el = li.appendChild(document.createElement("a"));
el.textContent = p.title;
el.href = p.url;
+ el = li.appendChild(document.createElement("span"));
+ el.textContent = " [score: " + r.score.toString() + "]";
root.appendChild(li);
});