settings_ui: Match all query words in search (#56835)

Settings search treated multi-word queries as OR, so “tab size” matched
any document whose words contained a prefix of “tab” or “size” --
flooding results with unrelated entries like “Show Tab Bar” and “Maximum
Tabs”.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Closes #56244.

Release Notes:

- Fixed settings UI search returning unrelated results for multi-word
queries
This commit is contained in:
Kunall Banerjee authored and GitHub committed 2026-05-15 14:17:57 +00:00
1 parent 076d63af7f
commit 8214d6489c
1 file changed
+4 -1
+4 -1
View File
@@ -1982,11 +1982,14 @@ impl SettingsWindow {
async move {
let query_lower = query.to_lowercase();
let query_words: Vec<&str> = query_lower.split_whitespace().collect();
if query_words.is_empty() {
return Vec::new();
}
search_index
.documents
.iter()
.filter(|doc| {
query_words.iter().any(|query_word| {
query_words.iter().all(|query_word| {
doc.words
.iter()
.any(|doc_word| doc_word.starts_with(query_word))