mirror of
https://github.com/huhu/rust-search-extension
synced 2024-11-13 23:27:13 +00:00
Fix result.others
This commit is contained in:
parent
68b6d2cb57
commit
3558333752
3 changed files with 5 additions and 8 deletions
|
@ -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);
|
||||
|
|
|
@ -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 || [];
|
||||
}
|
||||
}
|
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue