api: fuzzy search min_term_length configuration seems to have no effect
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
### Nomad version
```
Nomad v1.1.0-rc1 (c16a2850549eae74a0bfab5aad359b3c6926280f)
```
### Operating system and Environment details
macOS 10.14.6
```
~/Downloads/nomad-110-rc1 agent -dev -config=server-longer-minimum-search-and-enabled.hcl
```
### Issue
With the following server configuration (the seemingly-redundant `fuzzy_enabled` is due to #10587):
```
server {
search {
fuzzy_enabled = true
min_search_length = 3
}
}
```
When querying with a too-short search string, it still appears to search, or at least returns the results structure:
```
curl 'http://localhost:4646/v1/search/fuzzy' --data-raw '{"Text":"x","Context":"all"}'
{"Matches":{"evals":[],"deployment":[],"volumes":[],"scaling_policy":[]},"Truncations":{"evals":false,"volumes":false,"scaling_policy":false,"jobs":false,"nodes":false,"plugins":false,"deployment":false,"allocs":false,"namespaces":false},"Index":9,"LastContact":0,"KnownLeader":true}
```
Whereas running with no server configuration, a too-short query returns an error that specifies the minimum length:
```
curl 'http://localhost:4646/v1/search/fuzzy' --data-raw '{"Text":"x","Context":"all"}'
fuzzy search query must be at least 2 characters, got 1
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the /v1/search/fuzzy API and reproduce the curl request with server.search.min_search_length set to 3, then compare it with the default configuration behavior. The work is done when a query shorter than the configured minimum is rejected with the corresponding minimum-length error instead of returning a results structure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100