diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/docs/main.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/docs/main.js b/lib/docs/main.js index b43a289e48..dfe6c1e496 100644 --- a/lib/docs/main.js +++ b/lib/docs/main.js @@ -4328,9 +4328,9 @@ function addDeclToSearchResults(decl, declIndex, modNames, item, list, stack) { // shallow path are preferable const path_depth = canonPath.declNames.length * 50; // matching the start of a decl name is good - const match_from_start = decl_name.startsWith(term) ? -term.length * (1 -ignoreCase) : (decl_name.length - term.length) + 1; + const match_from_start = decl_name.startsWith(term) ? -term.length * (2 -ignoreCase) : (decl_name.length - term.length) + 1; // being a perfect match is good - const is_full_match = (list == result.full) ? -decl_name.length * (2 - ignoreCase) : decl_name.length - term.length; + const is_full_match = (decl_name === term) ? -decl_name.length * (1 - ignoreCase) : Math.abs(decl_name.length - term.length); // matching the end of a decl name is good const matches_the_end = decl_name.endsWith(term) ? -term.length * (1 - ignoreCase) : (decl_name.length - term.length) + 1; // explicitly penalizing scream case decls @@ -4409,7 +4409,7 @@ function addDeclToSearchResults(decl, declIndex, modNames, item, list, stack) { const href = navLink(canonPath.modNames, canonPath.declNames); - matchedItemsHTML += "<li><a href=\"" + href + "\">" + text + "</a></li>"; + matchedItemsHTML += "<li><a href=\"" + href + "\">" + text + "</a></li>"; } } |
