Skip to content
Snippets Groups Projects
Commit 16cfe72c authored by Ole Voldsæter's avatar Ole Voldsæter
Browse files

la til målfomer i autocomplete (som i gammel ordbok)

parent 4e0e0309
No related branches found
No related tags found
No related merge requests found
......@@ -149,10 +149,16 @@ export default {
let hits = q.length ? [{q: q, label: q + ' (fritekstsøk)'}] : []
response.data.forEach((item, i) => {
if (! hits[0] || hits[0].label != item.match) {
hits.splice(0, 0, {q: q, label: item.match, articles: []})
hits.splice(0, 0, {q: q, lang_set: new Set(), label: item.match, articles: []})
}
hits[0].lang_set.add(item.dictionary == 'bob' ? 'bm' : 'nn')
hits[0].articles.push(item)
});
hits.forEach(function (hit) {
if (hit.lang_set) {
hit.label += ` (${Array.from(hit.lang_set).join(', ')})`
}
});
hits.reverse()
resolve(hits.slice(0, 10))
})
......
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