mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-27 23:09:35 +02:00
Fallback to web search if local search has zero results. Updated packages
This commit is contained in:
parent
bce51bb2c4
commit
2485f4ff33
9 changed files with 645 additions and 658 deletions
|
@ -91,8 +91,18 @@ const SearchBar = (props: ComponentProps): JSX.Element => {
|
|||
// Local query -> redirect if at least 1 result found
|
||||
if (appSearchResult?.length) {
|
||||
redirectUrl(appSearchResult[0].url, sameTab);
|
||||
} else if (bookmarkSearchResult?.length) {
|
||||
} else if (bookmarkSearchResult?.[0]?.bookmarks?.length) {
|
||||
redirectUrl(bookmarkSearchResult[0].bookmarks[0].url, sameTab);
|
||||
} else {
|
||||
// no local results -> search the internet with the default search provider
|
||||
let template = query.template;
|
||||
|
||||
if (query.prefix === 'l') {
|
||||
template = 'https://duckduckgo.com/?q=';
|
||||
}
|
||||
|
||||
const url = `${template}${search}`;
|
||||
redirectUrl(url, sameTab);
|
||||
}
|
||||
} else {
|
||||
// Valid query -> redirect to search results
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue