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

filter suggestions after articles are loaded

parent 61cc0aed
No related branches found
No related tags found
No related merge requests found
......@@ -203,6 +203,18 @@ function navigate_to_query(self, word) {
load_articles(self, query, offset, self.perPage, "nn")
])
.then(() => {
if (self.event && self.scope != "b") {
self.inflection_suggestions = self.event.inflection_suggestions.filter((item) => {
if ((item[1] == 1 || item[1] == 3) && self.search_results.bm) {
return !self.search_results.bm[0].suggest.includes(item[0])
}
if ((item[1] == 2 || item[1] == 3) && self.search_results.nn) {
return !self.search_results.nn[0].suggest.includes(item[0])
}
})
} else {
self.inflection_suggestions = []
}
self.waiting_for_articles = false
history.replaceState({
article: self.article,
......@@ -307,18 +319,6 @@ export default {
},
select_result: function (event) {
this.event = event
if (this.event.inflection_suggestions) {
this.inflection_suggestions = this.event.inflection_suggestions.filter((item) => {
if ((item[1] == 1 || item[1] == 3) && this.search_results.bm) {
return !this.search_results.bm[0].suggest.includes(item[0])
}
if ((item[1] == 2 || item[1] == 3) && this.search_results.nn) {
return !this.search_results.nn[0].suggest.includes(item[0])
}
})
}
let path = `/${this.lang}/search`
let pos = this.pos_param()
let query = {q: event.match || event.q}
......
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