Skip to content

Conversation

@mroch
Copy link
Contributor

@mroch mroch commented Jul 6, 2023

Changes fuzzyScore to not treat uppercase characters in a common prefix as gap locations.

If you match FOO against FOO and FOOBAR, the score against FOO is +4 compared to FOOBAR: +2 for being a full match, and +2 because gap locations at the end of the word are only penalized -3 instead of -5. This PR fixes the latter +2. This makes the scores equal when boostFullMatch: false.

Fixes #187147

@mroch mroch force-pushed the fuzzy_score_uppercase branch from 636b3ab to 3616e3e Compare July 6, 2023 15:11
facebook-github-bot pushed a commit to facebook/flow that referenced this pull request Jul 7, 2023
Summary:
Uppercase characters in a common prefix of a fuzzy match are given an undue boost.

This manifests when trying to sort without boosting full matches. When searching for `F` with `boost_full_match = false`, the score for `F` is still +2 the score for `Foo` even though they should be equal.

Ports microsoft/vscode#187149 to our ocaml fork

Reviewed By: SamChou19815

Differential Revision: D47251873

fbshipit-source-id: 32e5102747cf3bb4c9ec613f613f546c52dbc596
facebook-github-bot pushed a commit to facebook/flow that referenced this pull request Jul 7, 2023
Summary:
Uppercase characters in a common prefix of a fuzzy match are given an undue boost.

This manifests when trying to sort without boosting full matches. When searching for `F` with `boost_full_match = false`, the score for `F` is still +2 the score for `Foo` even though they should be equal.

Ports microsoft/vscode#187149 to our ocaml fork

Reviewed By: SamChou19815

Differential Revision: D47251873

fbshipit-source-id: 6d6bf9dc0c87bb4c25f5064b751a8ecdb6d72329
@deepak1556 deepak1556 assigned jrieken and unassigned deepak1556 Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fuzzyScore boostFullMatch:false incorrect when pattern ends with uppercase

4 participants