apache / apache/netbeans

Go to File Search Should Not Prioritize Alphabetical "Fuzzy" Match Over Exact Match in Results

Open
#5,439 4 comments 0 reactions 0 assignees View on GitHub
Contribution welcome good first issue kind:feature
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Description

When using the Go to File search the results appear to be sorted alphabetically which means the default selection is commonly not what the user is looking for.

For example:
In the below screenshot I search for "DirectionalMovementOfIndicatorTest" and in the results, the default selection is a "fuzzy" match despite the exact match was also found.

![Search Annoyance](https://user-images.githubusercontent.com/6332181/216838893-75dd713c-db9a-4ac5-a7bf-d0477ff2c45f.PNG)

It would be nice if there's an exact match it's placed first and selected by default. The fuzzy matches can then come after, sorted via the existing criteria.

### How to reproduce

1. In a new or existing project create three new class files, all named similarly. For example:

DirectionalMovementDownOfIndicatorTest.java
DirectionalMovementOfIndicatorTest.java
DirectionalMovementUpOfIndicatorTest.java

2. Open the "Go to File" search (alt+shift+o on Windows)
3. Search for a file which name is not the first in natural sorting order (i.e. DirectionalMovementOfIndicatorTest.java)
4. Press ENTER as soon as the search results pop up cause you're in the zone
5. Notice with chagrin that you are not where you expected to be. Level of confusion correlated with how similar the classes are.

### Use case/motivation

This is low priority but if a UX uplift initiative ever gets going this should be included.

### Related issues

_No response_

### Are you willing to submit a pull request?

No

### Code of Conduct

Yes

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Go to File search with the three similarly named Java files described in the issue, then locate the search implementation; no source file or test is named. Done means an exact filename is ranked first and selected by default, while fuzzy matches retain the existing ordering afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
developer-experience
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.