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:
Maximilian Krög
2020-02-09 17:13:26 +01:00
parent d3b9b25429
commit 7640bcd163
2 changed files with 5 additions and 5 deletions

View File

@@ -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