From 6e11941ae9f03a9206e647bd4da0bfaf9b7f95f4 Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 30 Jul 2015 15:47:09 -0700 Subject: [PATCH] [Search] ES Provider error checks The elasticsearch provider returns an empty result when elasticsearch throws an error (probably a bad request). This prevents the aggregator from thinking that ES is loading infinitely. --- .../search/src/providers/ElasticsearchSearchProvider.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/features/search/src/providers/ElasticsearchSearchProvider.js b/platform/features/search/src/providers/ElasticsearchSearchProvider.js index 15f0b3681f..0c75f4d678 100644 --- a/platform/features/search/src/providers/ElasticsearchSearchProvider.js +++ b/platform/features/search/src/providers/ElasticsearchSearchProvider.js @@ -33,7 +33,7 @@ define( // so hide them here. var ID = "_id", SCORE = "_score", - DEFAULT_MAX_RESULTS = 999999; + DEFAULT_MAX_RESULTS = 100; /** * A search service which searches through domain objects in @@ -165,6 +165,10 @@ define( }).then(function (rawResults) { // ...then process the data return processResults(rawResults, timestamp); + }).catch(function (err) { + // In case of error, return nothing. (To prevent + // infinite loading time.) + return {hits: [], total: 0}; }); } else { return {hits: [], total: 0};