Option to disable search suggestions

This commit is contained in:
Bnyro
2023-06-13 10:24:29 +02:00
parent 06c5601e75
commit bf1ecc4c25
3 changed files with 19 additions and 2 deletions

View File

@@ -50,13 +50,16 @@ export default {
if (!this.searchText) {
if (this.getPreferenceBoolean("searchHistory", false))
this.searchSuggestions = JSON.parse(localStorage.getItem("search_history")) ?? [];
} else {
} else if (this.getPreferenceBoolean("searchSuggestions", true)) {
this.searchSuggestions =
(
await this.fetchJson(this.apiUrl() + "/opensearch/suggestions", {
query: this.searchText,
})
)?.[1] ?? [];
} else {
this.searchSuggestions = [];
return;
}
this.searchSuggestions.unshift(this.searchText);
this.setSelected(0);