Fix result.others

This commit is contained in:
Folyd 2024-06-22 22:43:41 -07:00
parent 68b6d2cb57
commit 3558333752
3 changed files with 5 additions and 8 deletions

View file

@ -43,8 +43,7 @@ export default class RustSearchOmnibox {
omnibox.bootstrap({
onSearch: async (query) => {
const result = await stdSearcher.search(query);
return result.others || [];
return await stdSearcher.search(query);
},
onFormat: formatDoc,
onAppend: async (query) => {
@ -86,8 +85,7 @@ export default class RustSearchOmnibox {
name: "Source code",
onSearch: async (query) => {
query = query.replace(/^s(?:rc)?:/i, "");
const result = await stdSearcher.search(query);
return result.others || [];
return await stdSearcher.search(query);
},
onFormat: (index, doc) => {
let { content, description } = formatDoc(index, doc);
@ -110,8 +108,7 @@ export default class RustSearchOmnibox {
name: "Nightly docs",
onSearch: async (query) => {
query = query.replaceAll("/", "").trim();
const result = await nightlySearcher.search(query);
return result.others || [];
return await nightlySearcher.search(query);
},
onFormat: (index, doc) => {
let { content, description } = formatDoc(index, doc);

View file

@ -23,6 +23,7 @@ export default class DocSearch extends DocSearchV2 {
async search(query) {
if (!query) return [];
return await this.execQuery(DocSearchV2.parseQuery(query), null, this.name);
let result = await this.execQuery(DocSearchV2.parseQuery(query), null, this.name);
return result.others || [];
}
}

View file

@ -71,7 +71,6 @@ export default class CrateDocSearch {
}
let results = await searcher.search(keyword);
results = results.others || [];
// Push result footer.
results.push({
content: await searcher.getSearchUrl(keyword),