title: Custom filtering knockout js observableArray
body: <p>I have an observableArray with testsuites that I want to filter according to text in a search field. The filtering updates after every key stroke, so I am searching for the most efficient method.</p>
  
  <p>Check out this JS-fiddle for a simplified version of my problem:</p>
  
  <p><a href="http://jsfiddle.net/LkqTU/23180/" rel="nofollow">http://jsfiddle.net/LkqTU/23180/</a></p>
  
  <p>Below, you can see a snippet from the fiddle. As of now the filtering takes the entire text in the search field and checks the "Name" field of each testsuite against it. </p>
  
  <p><strong>What I want</strong> is to divide the filter text into words and search every field in testsuite for every word in the search field.</p>
  
  <p>I you for example write "user lol" in the search field, I want it to only return the testsuite that contains these words in any field (here two of the testsuites has "user" in the name and one has "lol" in the description).</p>
  
  <pre><code>self.filteredTestsuites = ko.computed(function () {
  
      // If many white spaces in a row, replace with only one white space
      fText = self.filterText().replace(/\s+/g, ' ');
  
      // If there is anything in the search box, filter for this
      // As of now this does not divide the filterText and only searches the Name field
      var filteredCollection = ko.utils.arrayFilter(self.testsuites(), function(test) {
          if(fText.length)
              return ( test.name.toUpperCase().indexOf(fText.toUpperCase()) &gt;= 0);
          else
              return 1;
      });
  
      return filteredCollection;
  }, self);
  </code></pre>
  
  <p><strong>My question is</strong> how can I do the searching most efficient?
  A possible solution is that for every word in the search field, I search every field in the current testsuite. However I would like a more generic solution, where I dont have to specify the fields (e.g. name, description, etc), and I am also unsure about the efficiency of this method.</p>
  
  <p>Suggestions?</p>