|
|
@ -455,9 +455,6 @@ $.fn.search = function(parameters) { |
|
|
|
fuzzyResults = [], |
|
|
|
searchExp = searchTerm.toString().replace(regExp.escape, '\\$&'), |
|
|
|
matchRegExp = new RegExp(regExp.beginsWith + searchExp, 'i'), |
|
|
|
searchFields = (searchFields !== undefined) |
|
|
|
? searchFields |
|
|
|
: settings.searchFields, |
|
|
|
|
|
|
|
// avoid duplicates when pushing results
|
|
|
|
addResult = function(array, result) { |
|
|
@ -471,6 +468,15 @@ $.fn.search = function(parameters) { |
|
|
|
} |
|
|
|
; |
|
|
|
source = source || settings.source; |
|
|
|
searchFields = (searchFields !== undefined) |
|
|
|
? searchFields |
|
|
|
: settings.searchFields |
|
|
|
; |
|
|
|
|
|
|
|
// search fields should be array to loop correctly
|
|
|
|
if(!$.isArray(searchFields)) { |
|
|
|
searchFields = [searchFields]; |
|
|
|
} |
|
|
|
|
|
|
|
// exit conditions if no source
|
|
|
|
if(source === undefined) { |
|
|
@ -478,11 +484,6 @@ $.fn.search = function(parameters) { |
|
|
|
return []; |
|
|
|
} |
|
|
|
|
|
|
|
// search fields should be array to loop correctly
|
|
|
|
if(!$.isArray(searchFields)) { |
|
|
|
searchFields = [searchFields]; |
|
|
|
} |
|
|
|
|
|
|
|
// iterate through search fields looking for matches
|
|
|
|
$.each(searchFields, function(index, field) { |
|
|
|
$.each(source, function(label, content) { |
|
|
|