Only match the displayed name of items when searching
Currently the search term is matched against the longname of members. Because of this most members are matched when searching for a class / module and also searching for 'mod' matches everything as all longnames start with 'module:'
This commit is contained in:
@@ -29,7 +29,7 @@ $(function () {
|
||||
var getSearchWeight = function (searchTerm, $matchedItem) {
|
||||
let weight = 0;
|
||||
// We could get smarter on the weight here
|
||||
if ($matchedItem.data('shortname') === searchTerm) {
|
||||
if ($matchedItem.data('name') === searchTerm) {
|
||||
weight++;
|
||||
}
|
||||
return weight;
|
||||
@@ -48,7 +48,7 @@ $(function () {
|
||||
.replace('module-', 'module:')
|
||||
.replace(/_/g, '/')
|
||||
.replace(/-/g, '~');
|
||||
var $currentItem = $('.navigation .item[data-name*="' + longname.toLowerCase() + '"]:eq(0)');
|
||||
var $currentItem = $('.navigation .item[data-longname="' + longname + '"]:eq(0)');
|
||||
|
||||
if ($currentItem.length) {
|
||||
$currentItem
|
||||
|
||||
Reference in New Issue
Block a user