Upgrade search-index to v1.40.0, increase MAX_SUGGEST_SIZE to 7

This commit is contained in:
Folyd 2019-12-20 23:38:17 +08:00
parent 92151225d8
commit 13546e8d08
2 changed files with 10 additions and 8 deletions

View file

@ -1,3 +1,5 @@
let MAX_SUGGEST_SIZE = 7;
function Omnibox() { function Omnibox() {
this.isChrome = navigator.userAgent.indexOf("Chrome") !== -1; this.isChrome = navigator.userAgent.indexOf("Chrome") !== -1;
// Firefox doesn't support tags in search suggestion. // Firefox doesn't support tags in search suggestion.
@ -28,11 +30,11 @@ Omnibox.prototype.bootstrap = function() {
} }
} }
if (this.suggestResults.length < 5 && /e\d{2,4}$/ig.test(query)) { if (this.suggestResults.length < MAX_SUGGEST_SIZE && /e\d{2,4}$/ig.test(query)) {
this.appendErrorIndexResult(query, 5 - this.suggestResults.length); this.appendErrorIndexResult(query, MAX_SUGGEST_SIZE - this.suggestResults.length);
} }
if (this.suggestResults.length < 5) { if (this.suggestResults.length < MAX_SUGGEST_SIZE) {
await this.appendCratesResult(query); await this.appendCratesResult(query);
} }

File diff suppressed because one or more lines are too long