Skip to content
Snippets Groups Projects
Commit 4933cbdb authored by Henrik Askjer's avatar Henrik Askjer
Browse files

Unshift verbatim search if query equals search

parent f36d087c
No related branches found
No related tags found
No related merge requests found
......@@ -69,15 +69,14 @@
});
hits.reverse()
hits = hits.slice(0, 9)
hits.unshift({q: encodeURIComponent(q), label: q + ' '})
}
hits.sort( (h1, h2) => {
let val1 = h1.label.length * 10 + (h1.label[0].toLowerCase() === h1.label[0] ? 0 : 1)
let val2 = h2.label.length * 10 + (h2.label[0].toLowerCase() === h2.label[0] ? 0 : 1)
return val1 - val2
})
if (q) {
hits.push({q: encodeURIComponent(q), label: q + ' '})
}
self.items = hits
self.loading = false
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment