code: function webWorkerSearchFactory($q, $rootScope, NG_PAGES) {
  
      console.log('Using WebWorker Search Index')
  
      var searchIndex = $q.defer();
      var results;
  
      var worker = new Worker('js/search-worker.js');
  
      // The worker will send us a message in two situations:
      // - when the index has been built, ready to run a query
      // - when it has completed a search query and the results are available
      worker.onmessage = function(oEvent) {
        $rootScope.$apply(function() {
  
          switch(oEvent.data.e) {
            case 'index-ready':
              searchIndex.resolve();
              break;
            case 'query-ready':
              var pages = oEvent.data.d.map(function(path) {
                return NG_PAGES[path];
              });
              results.resolve(pages);
              break;
          }
        });
      };
  
      // The actual service is a function that takes a query string and
      // returns a promise to the search results
      return function(q) {
  
        // We only run the query once the index is ready
        return searchIndex.promise.then(function() {
  
          results = $q.defer();
          worker.postMessage({ q: q });
          return results.promise;
        });
      };
    }
docs: This version of the service builds the index in a WebWorker, which does not block rendering and other browser activities. It should only be used where the browser does support WebWorkers