title: how to search for text in json array
body: <p>Need to search JSON array for text string.</p>
  
  <p>The facts/joke module in Bixby currently searches by tags rather than full text.   I want to modify the filter function to search the full text field.</p>
  
  <p>At present, the filter function looks like this.</p>
  
  <pre><code>exports.findContentJS = findContentJS
  function findContentJS (items, searchTerm) {
    var matches = items.filter(function (x) {
      if (x.tags) {
        // Filter on filter 
        var matchTag = x.tags.filter(function (y) {
          return y == searchTerm
        });
        return (matchTag != "");
      }
    });
    return matches;
  }
  </code></pre>
  
  <p>I tried changing "tags" to "text".</p>
  
  <p>So for a search on "Mark Twain" I get an error message like this:</p>
  
  <blockquote>
    <p>TypeError: Cannot find function filter in object A banker is a fellow who lends you his umbrella when the sun is shining and wants it back the minute it begins to rain. Source: Mark Twain</p>
  </blockquote>
  
  <p>This is the corresponding object in the json file:</p>
  
  <pre><code>{
    tags: ["literature"],
    text: "A banker is a fellow who lends you his umbrella when the sun is shining and wants it back the minute it begins to rain. Source: Mark Twain"
  }
  </code></pre>
  
  <p>So it appears to me that I need to make a likely small change in the function so that it searches both the tags &amp; the text field in the array.</p>