web/lib/results.js
function addUpdated(results) {
  results.forEach(function(result) {
    result = normalizeResult(result);
    if (!lastQuery.results.hits) {
      lastQuery = { results: { hits: { total : 0, hits: [] } } };
    } else {
      var i = 0, l = lastQuery.results.hits.hits.length;
      for (i; i < l; i++) {
        if (lastQuery.results.hits.hits[i]._source.uri === result._source.uri) {
          lastQuery.results.hits.hits.splice(i, 1);
          break;
        }
      }
    }
    lastQuery.results.hits.hits.unshift(result);
  });
  updateResults(lastQuery);
}
function addUpdated(results) {
  results.forEach(function(result) {
    result = normalizeResult(result);
    if (!lastQuery.results.hits) {
      lastQuery = { results: { hits: { total : 0, hits: [] } } };
    } else {
      var i = 0, l = lastQuery.results.hits.hits.length;
      for (i; i < l; i++) {
        if (lastQuery.results.hits.hits[i]._source.uri === result._source.uri) {
          lastQuery.results.hits.hits.splice(i, 1);
          break;
        }
      }
    }
    lastQuery.results.hits.hits.unshift(result);
  });
  updateResults(lastQuery);
}
function addUpdated ( results ) { results . forEach ( function ( result ) { result = normalizeResult ( result ) ; if ( ! lastQuery . results . hits ) { lastQuery = { results : { hits : { total : 0 , hits : [ ] } } } ; } else { var i = 0 , l = lastQuery . results . hits . hits . length ; for ( i ; i < l ; i ++ ) { if ( lastQuery . results . hits . hits [ i ] . _source . uri === result . _source . uri ) { lastQuery . results . hits . hits . splice ( i , 1 ) ; break ; } } } lastQuery . results . hits . hits . unshift ( result ) ; } ) ; updateResults ( lastQuery ) ; }
add updated items
add updated items