api: expose server search configuration
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
### Proposal
`GET /v1/search/config` (?) could respond with
```
{
"FuzzyEnabled": false,
…
}
```
or
```
{
"MinTermLength": 5,
…
}
```
### Use-cases
The fuzzy search UX via the web UI could be improved if the application knew:
• whether fuzzy search was disabled
• what the minimum search term length is before results will be returned
The UI currently runs a [feature detection fuzzy search query](https://github.com/hashicorp/nomad/blob/92391683da29a6f11c2b375c0b9880a27acea8fa/ui/app/services/system.js#L136-L151) on application load and hides the search control when the `500` response indicates `fuzzy search is not enabled`. It would be nice to be able to learn this directly vs via a fake query.
The UI’s search is [currently hard-coded](https://github.com/hashicorp/nomad/blob/92391683da29a6f11c2b375c0b9880a27acea8fa/ui/app/components/global-search/control.js#L133-L136) to require a minimum of two characters before dispatching a query. If the fuzzy search is configured with `min_term_length: 5` or anything greater than 2, the search shows “No results found” for a shorter because there’s no way to know what the configured value is. (It appears to be expected that the endpoint returns [an error](https://github.com/hashicorp/nomad/blob/0af476263b5c6f12a43a069070400e1762ad17c2/nomad/search_endpoint_test.go#L1112) that the configuration could be derived from, but that’s not working for me, I’ll document that separately.)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with nomad/search_endpoint_test.go and the referenced UI code in ui/app/services/system.js and ui/app/components/global-search/control.js. Review how fuzzy-search availability and minimum term length are currently detected or hard-coded. Done means the API exposes the relevant search configuration so the UI no longer needs a fake query or fixed threshold.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, javascript
- Domain
- api, backend, search, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100