code: function localSearchFactory($http, $timeout, NG_PAGES) {
  
      console.log('Using Local Search Index');
  
      // Create the lunr index
      var index = lunr(function() {
        this.ref('path');
        this.field('titleWords', {boost: 50});
        this.field('members', { boost: 40});
        this.field('keywords', { boost : 20 });
      });
  
      // Delay building the index by loading the data asynchronously
      var indexReadyPromise = $http.get('js/search-data.json').then(function(response) {
        var searchData = response.data;
        // Delay building the index for 500ms to allow the page to render
        return $timeout(function() {
          // load the page data into the index
          angular.forEach(searchData, function(page) {
            index.add(page);
          });
        }, 500);
      });
  
      // The actual service is a function that takes a query string and
      // returns a promise to the search results
      // (In this case we just resolve the promise immediately as it is not
      // inherently an async process)
      return function(q) {
        return indexReadyPromise.then(function() {
          var hits = index.search(q);
          var results = [];
          angular.forEach(hits, function(hit) {
            results.push(NG_PAGES[hit.ref]);
          });
          return results;
        });
      };
    }
docs: This version of the service builds the index in the current thread, which blocks rendering and other browser activities. It should only be used where the browser does not support WebWorkers