mirror of
https://github.com/zed-industries/zed.git
synced 2026-12-04 03:53:21 +01:00
# Objective Fixes #55195 The issue is that if a path contains some part of the query multiple times, like `x/x.py` it may not outrank results like `y/x.py` (for the query `x`), despite the fact that it should. ## Solution I added a very small bonus that rewards the proximity of the matches to the tail-end of the path, this is easy because nucleo naturally favors the tail, so the tail most match for a given query atom will be the one that is found. This bonus does need to be small, though not too small, in order to not disrupt any other scoring orders. The main benefit of this over a different approach like counting occurrences of an atom is speed, this approach is constant time and just overall very low overhead, but performance would be much more of a concern with other approaches. ## Testing All the file finder tests still pass. Directly showing off the difference on the case from the original issue: <img width="944" height="1123" alt="Screenshot 2026-06-12 at 3 36 13 PM" src="https://github.com/user-attachments/assets/e4d2efdd-284f-4ef6-931f-fb7f95e801f8" /> This case shows that it *doesn't* overpower the other bonuses, like the length bonus. <img width="944" height="1123" alt="Screenshot 2026-06-12 at 3 36 06 PM" src="https://github.com/user-attachments/assets/46dcc17d-ba28-4fc3-a119-3d5ef49785bc" /> ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - file_finder: Improved search results from fuzzy file search. --------- Co-authored-by: Finn Evers <finn@zed.dev>