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

Add truncated search

parent 62b6a7b7
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<span class="search-hit"> <span class="search-hit">
{{data.item.label}} {{data.item.label}}
</span> </span>
({{{"b": "bm", "n": "nn", "bn": "bm, nn" }[data.item.lang] || ["søker...","fritekst","avansert søk"][data.item.search]}}) ({{{"b": "bm", "n": "nn", "bn": "bm, nn" }[data.item.lang] || ["søker...","trunkert søk","avansert søk"][data.item.search]}})
</template> </template>
<template slot="no-data"> <template slot="no-data">
<div></div> <div></div>
...@@ -83,12 +83,12 @@ ...@@ -83,12 +83,12 @@
if (/_|\*|\|/.test(q)) { if (/_|\*|\|/.test(q)) {
search = 2 search = 2
} }
this.items.splice(0,1, {q: q, match: q, label: q, time: time, search: search}) // Whitespace necessary in case option already exists in dropdown
this.items.splice(0,1, {q: q, label: q +" ", time: time, search: search})
} }
} }
else { else {
// Whitespace necessary in case option already exists in dropdown this.items.push({q: q, label: q, time: time, search: search})
this.items.push({q: q, match: q, label: q+" ", time: time, search: search})
} }
let self = this let self = this
self.api.get('suggest?', {params: {q: q, dict: self.$parent.lang, n: 80, scope: 'w', stage: self.$parent.stage}}) self.api.get('suggest?', {params: {q: q, dict: self.$parent.lang, n: 80, scope: 'w', stage: self.$parent.stage}})
...@@ -101,7 +101,11 @@ ...@@ -101,7 +101,11 @@
suggestions.unshift({q: q, label: q, time: time, search: 2}) suggestions.unshift({q: q, label: q, time: time, search: 2})
} }
self.items = suggestions if (!suggestions.length) {
self.items = [{q: q+"*", label: q, time: time, search: 1}]
} else {
self.items = suggestions
}
} }
self.loading = false 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