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

Merge branch 'fix_premature_autocomplete' into 'master'

Unshift verbatim search if query equals search

See merge request spraksamlingane/beta.ordbok.uib.no!40
parents f36d087c 4933cbdb
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