[clangd] Use fuzzy match to select top N index results.
authorSam McCall <sam.mccall@gmail.com>
Thu, 18 Jan 2018 08:35:04 +0000 (08:35 +0000)
committerSam McCall <sam.mccall@gmail.com>
Thu, 18 Jan 2018 08:35:04 +0000 (08:35 +0000)
commita5ce243fa334390f6cd8f4e04cd6ed0bf0fd1032
tree560af7b3d44e15d3f49f38ebc34acf433b0edf9d
parent83b0a98902077b2bc95bde4162e0f210d4b50f61
[clangd] Use fuzzy match to select top N index results.

Summary:
This makes performance slower but more predictable (it always processes
every symbol). We need to find ways to make this fast, possibly by precomputing
short queries or capping the number of scored results. But our current approach
is too naive.

It also no longer returns results in a "good" order. In fact it's pathological:
the top N results are ranked from worst to best. Indexes aren't responsible for
ranking and MergedIndex can't do a good job, so I'm pleased that this will make
any hidden assumptions we have more noticeable :-)

Reviewers: hokein

Subscribers: klimek, ilya-biryukov, cfe-commits

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

llvm-svn: 322821
clang-tools-extra/clangd/index/MemIndex.cpp
clang-tools-extra/unittests/clangd/IndexTests.cpp