From 16cfe72cb9d4ad156d4bf99d3e8415d99caeed89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ole=20Volds=C3=A6ter?= <ole.voldsater@uib.no>
Date: Mon, 25 Jan 2021 08:39:13 +0100
Subject: [PATCH] =?UTF-8?q?la=20til=20m=C3=A5lfomer=20i=20autocomplete=20(?=
 =?UTF-8?q?som=20i=20gammel=20ordbok)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/App.vue | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/App.vue b/src/App.vue
index 9f33d03..323e1f8 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -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))
                                       })
-- 
GitLab