Skip to content

Commit 6beae1e

Browse files
committed
Allow search for '.foo', which searches for foo but only in Methods
Part of #1086
1 parent 0b3a800 commit 6beae1e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

template/search_template.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,21 @@ $.extend( $.ui.autocomplete, {
125125
},
126126
filter: function( array, term ) {
127127
current_search = term.toLowerCase();
128+
129+
var search_method = false;
130+
if (term.startsWith(".")) {
131+
search_method = true;
132+
term = term.substr(1);
133+
}
134+
128135
var len = term.length;
129136
var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
130137
var OK_distance = len > 9 ? 4 : len > 6 ? 3 : len > 4 ? 2 : 1;
131138
return $.grep( array, function( value ) {
139+
console.log(value);
140+
if (search_method && value.category != 'Method') {
141+
return false;
142+
}
132143
if (len >=2 ) {
133144
var result = sift4( value.value, term, 4, 0);
134145
if (result <=OK_distance) {

0 commit comments

Comments
 (0)