Filter JSON results with jQuery Filter JSON results with jQuery ajax ajax

Filter JSON results with jQuery


Found it!

In line 76-80 of the original you can change the var matches"whatever" and filter the results. It will still import all results but it will adjust to remove the results carrying the string you specify upon imputing search terms. E.g:

var results = self.links            .reduce(function(scores, link, linkIndex) {              var score = searchTerms.reduce(function(score, searchTerm) {                if (score !== false) {     //modify one of these below, my example on the first var:                  var matchesTitle = ((link.title).match('YOURSTRINGHERE'));                  var matchesURL = (link.url.match(searchTerm.rgx) || '').length;                  var matchesDescr = ((link.description || '').match(searchTerm.rgx) || '').length;                  var matchesKeywords = ((link.keywords || '').match(searchTerm.rgx) || '').length;                  var matchesAny = !!(matchesTitle || matchesURL || matchesDescr || matchesKeywords);                  return searchTerm.must !== !matchesAny