Feature: search suggestions for search and quick launch (#2775)

---------

Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
Florian Hye 2024-02-01 02:17:42 +01:00 committed by GitHub
parent f0635db51d
commit d5af7eda63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 269 additions and 92 deletions

View file

@ -359,12 +359,14 @@ There are a few optional settings for the Quick Launch feature:
- `searchDescriptions`: which lets you control whether item descriptions are included in searches. This is off by default. When enabled, results that match the item name will be placed above those that only match the description.
- `hideInternetSearch`: disable automatically including the currently-selected web search (e.g. from the widget) as a Quick Launch option. This is false by default, enabling the feature.
- `showSearchSuggestions`: shows search suggestions for the internet search. This value will be inherited from the search widget if it is not specified. If it is not specified there either, it will default to false.
- `hideVisitURL`: disable detecting and offering an option to open URLs. This is false by default, enabling the feature.
```yaml
quicklaunch:
searchDescriptions: true
hideInternetSearch: true
showSearchSuggestions: true
hideVisitURL: true
```

View file

@ -9,6 +9,7 @@ You can add a search bar to your top widget area that can search using Google, D
- search:
provider: google # google, duckduckgo, bing, baidu, brave or custom
focus: true # Optional, will set focus to the search bar on page load
showSearchSuggestions: true # Optional, will show search suggestions. Defaults to false
target: _blank # One of _self, _blank, _parent or _top
```
@ -17,8 +18,10 @@ or for a custom search:
```yaml
- search:
provider: custom
url: https://lougle.com/?q=
url: https://www.ecosia.org/search?q=
target: _blank
suggestionUrl: https://ac.ecosia.org/autocomplete?type=list&q= # Optional
showSearchSuggestions: true # Optional
```
multiple providers is also supported via a dropdown (excluding custom):
@ -28,4 +31,25 @@ multiple providers is also supported via a dropdown (excluding custom):
provider: [brave, google, duckduckgo]
```
The response body for the URL provided with the `suggestionUrl` option should look like this:
```json
[
"home",
[
"home depot",
"home depot near me",
"home equity loan",
"homeworkify",
"homedepot.com",
"homebase login",
"home depot credit card",
"home goods"
]
]
```
The first entry of the array contains the search query, the second one is an array of the suggestions.
In the example above, the search query was **home**.
_Added in v0.1.6, updated in 0.6.0_