Skip to content
This repository has been archived by the owner on Mar 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1 from jonathanwiesel/array-support
Browse files Browse the repository at this point in the history
Added support for array properties.
  • Loading branch information
christian-fei committed Jan 21, 2014
2 parents 498ad61 + 4738351 commit 7a04313
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions simpleJekyllSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,19 @@
for (var i = 0; i < jsonData.length; i++) {
var obj = jsonData[i];
for (key in obj) {
if (obj.hasOwnProperty(key) && obj[key].toLowerCase().indexOf(str.toLowerCase()) >= 0){
matches.push(obj);
break;
if(obj.hasOwnProperty(key)){
if (obj[key] instanceof Array){
var seen = false;
for (var j = 0; j < obj[key].length; j++){
if(obj[key][j].toLowerCase().indexOf(str.toLowerCase()) >= 0){
matches.push(obj);
break;
}
}
}else if (obj[key].toLowerCase().indexOf(str.toLowerCase()) >= 0){
matches.push(obj);
break;
}
}
}
}
Expand Down Expand Up @@ -88,4 +98,4 @@
searchResults.children().remove();
}
}
}(jQuery));
}(jQuery));

0 comments on commit 7a04313

Please sign in to comment.