diff options
| author | bors <bors@rust-lang.org> | 2014-07-31 07:51:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-07-31 07:51:38 +0000 |
| commit | 28ae6f53299495019b6bac8c1bba2bcbb19de15c (patch) | |
| tree | aabe9db990f3d8225ce56700b892bad2faf8d0cd /src/rustllvm/RustWrapper.cpp | |
| parent | 7c28dd080ce4253d8b0126d6cf9bfc2ba0004cf8 (diff) | |
| parent | c614510ddb0eca24ee102511feb69a159238a996 (diff) | |
| download | rust-28ae6f53299495019b6bac8c1bba2bcbb19de15c.tar.gz rust-28ae6f53299495019b6bac8c1bba2bcbb19de15c.zip | |
auto merge of #15385 : jroweboy/rust/master, r=brson
This enables the docs search function to be more forgiving for spelling mistakes. The algorithm works as a dynamic programming algorithm to detect the minimum number of changes required to the search parameter string in order to match any string in the search index. If the number of changes is less then a threshold (currently defined as 3), then the search parameter will be included as it is a possible misspelling of the word. Any results returned by the algorithm are sorted by distance and are ranked lower than results that are partial or exact matches (aka the matches returned by the original search algorithm). Additionally, the increment in the for loops in this file were using one of three different ways to increment (`i += 1` `i++` and `++i`) so I just standardized it to `++i`. As an example, consider searching for the word `String` and accidentally typing in `Strnig`. The old system would return no results because it is a misspelling, but the Levenshtein distance between these two inputs is only two, which means that this will return `String` as a result. Additionally, it will return a few other results such as `strong`, and `StdRng` because these are also similar to `Strnig`. Because of the ranking system though, this change should be unobtrusive to anyone that spells the words correctly, as those are still ranked first before any Levenshtein results.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
