From 12efb47be74bc52ca67a7600e588c08ad8c67590 Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Fri, 16 Oct 2015 16:09:51 -0700 Subject: [PATCH] [Search] Remove timeouts and timestamps Remove timeouts and timestamps which were not effectively doing anything. --- .../elastic/src/ElasticSearchProvider.js | 1 - .../src/services/GenericSearchProvider.js | 3 --- .../search/src/services/GenericSearchWorker.js | 6 ++---- .../search/src/services/SearchAggregator.js | 17 +++++------------ 4 files changed, 7 insertions(+), 20 deletions(-) diff --git a/platform/persistence/elastic/src/ElasticSearchProvider.js b/platform/persistence/elastic/src/ElasticSearchProvider.js index bc313f4deb..e42cd6553d 100644 --- a/platform/persistence/elastic/src/ElasticSearchProvider.js +++ b/platform/persistence/elastic/src/ElasticSearchProvider.js @@ -142,7 +142,6 @@ define([ return { hits: searchResults, total: response.data.hits.total, - timedOut: response.data.timed_out }; }; diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index 907ab33189..6e7a7168a0 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -70,13 +70,11 @@ define([ * Query the search provider for results. * * @param {String} input the string to search by. - * @param {Number} timestamp part of the SearchProvider interface, ignored. * @param {Number} maxResults max number of results to return. * @returns {Promise} a promise for a modelResults object. */ GenericSearchProvider.prototype.query = function ( input, - timestamp, maxResults ) { if (!maxResults) { @@ -225,7 +223,6 @@ define([ var pendingQuery = this.pendingQueries[event.data.queryId], modelResults = { - timedOut: event.data.timedOut, total: event.data.total }; diff --git a/platform/search/src/services/GenericSearchWorker.js b/platform/search/src/services/GenericSearchWorker.js index 4ef44e29ab..928f66cab8 100644 --- a/platform/search/src/services/GenericSearchWorker.js +++ b/platform/search/src/services/GenericSearchWorker.js @@ -61,13 +61,12 @@ /** * Gets search results from the indexedItems based on provided search - * input. Returns matching results from indexedItems, as well as the - * timestamp that was passed to it. + * input. Returns matching results from indexedItems * * @param data An object which contains: * * input: The original string which we are searching with * * maxResults: The maximum number of search results desired - * * timestamp: The time identifier from when the query was made + * * queryId: an id identifying this query, will be returned. */ function search(data) { // This results dictionary will have domain object ID keys which @@ -79,7 +78,6 @@ request: 'search', results: {}, total: 0, - timedOut: false, queryId: data.queryId }, matches = {}; diff --git a/platform/search/src/services/SearchAggregator.js b/platform/search/src/services/SearchAggregator.js index abb6478936..b22bfbae18 100644 --- a/platform/search/src/services/SearchAggregator.js +++ b/platform/search/src/services/SearchAggregator.js @@ -31,8 +31,7 @@ define([ ) { "use strict"; - var DEFAULT_TIMEOUT = 1000, - DEFAULT_MAX_RESULTS = 100; + var DEFAULT_MAX_RESULTS = 100; /** * Aggregates multiple search providers as a singular search provider. @@ -57,7 +56,7 @@ define([ /** * Sends a query to each of the providers. Returns a promise for * a result object that has the format - * {hits: searchResult[], total: number, timedOut: boolean} + * {hits: searchResult[], total: number} * where a searchResult has the format * {id: string, object: domainObject, score: number} * @@ -87,9 +86,7 @@ define([ resultPromises = this.providers.map(function (provider) { return provider.query( inputText, - timestamp, - maxResults, - DEFAULT_TIMEOUT + maxResults ); }); @@ -98,16 +95,13 @@ define([ .then(function (providerResults) { var modelResults = { hits: [], - totals: 0, - timedOut: false + totals: 0 }; providerResults.forEach(function (providerResult) { modelResults.hits = modelResults.hits.concat(providerResult.hits); modelResults.totals += providerResult.totals; - modelResults.timedOut = - modelResults.timedOut || providerResult.timedOut; }); aggregator.orderByScore(modelResults); @@ -195,8 +189,7 @@ define([ .then(function (objects) { var objectResults = { - totals: modelResults.totals, - timedOut: modelResults.timedOut + totals: modelResults.totals }; objectResults.hits = modelResults