Skip to content

Commit

Permalink
Increase doc search MAX_LEV_DISTANCE to 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Folyd committed Apr 15, 2020
1 parent 836d5d3 commit 1243470
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion extension/search/docs/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var TY_PRIMITIVE = itemTypes.indexOf("primitive");
var TY_KEYWORD = itemTypes.indexOf("keyword");

// Max levenshtein distance.
var MAX_LEV_DISTANCE = 2;
var MAX_LEV_DISTANCE = 3;

class DocSearch {

Expand Down
3 changes: 1 addition & 2 deletions extension/search/docs/crate-doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ class CrateDocSearchManager {
return crate;
});

let len = list.length;
list = list.filter(item => !crateName || item.name.toLowerCase().indexOf(crateName) > -1)
.sort((a, b) => a.name.localeCompare(b.name));
list.unshift({
content: crateName, // Non-empty value is required for content, so maybe give it a crate name.
description: `Following ${len} crate(s) were added by you, select one to search their docs exclusively.`
description: `Following ${list.length} crate(s) were added by you, select one to search their docs exclusively.`
});
return list;
}
Expand Down

0 comments on commit 1243470

Please sign in to comment.