[clangd] Tune the fuzzy-matching algorithm
authorIlya Biryukov <ibiryukov@google.com>
Fri, 15 Mar 2019 14:00:49 +0000 (14:00 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Fri, 15 Mar 2019 14:00:49 +0000 (14:00 +0000)
commit373bee85c2b31332d49db329cdbfb5f7c7342a04
tree2a67c227a420cee6ebd813fc1b797b0e657a1940
parent339daae806b208cad060ce93f63e40f24a311812
[clangd] Tune the fuzzy-matching algorithm

Summary:
To reduce the gap between prefix and initialism matches.

The motivation is producing better scoring in one particular example,
but the change does not seem to cause large regressions in other cases.

The examples is matching 'up' against 'unique_ptr' and 'upper_bound'.
Before the change, we had:
  - "[u]nique_[p]tr" with a score of 0.3,
  - "[up]per_bound" with a score of 1.0.

A 3x difference meant that symbol quality signals were almost always ignored
and 'upper_bound' was always ranked higher.

However, intuitively, the match scores should be very close for the two.

After the change we have the following scores:
- "[u]nique_[p]tr" with a score of 0.75,
- "[up]per_bound" with a score of 1.0.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D59300

llvm-svn: 356261
clang-tools-extra/clangd/FuzzyMatch.cpp
clang-tools-extra/unittests/clangd/FuzzyMatchTests.cpp