diff --git a/js/search/queue.js b/js/search/queue.js index ad6d18f6..65452808 100644 --- a/js/search/queue.js +++ b/js/search/queue.js @@ -7,7 +7,7 @@ let makeBoundTimedCollector = function(isIndexing, timeout, callback) { if (!timer){ timer = setTimeout(function(){ if (!isIndexing) { - flush(getQueue()) + flush(getQueue()); } }, timeout); } @@ -28,11 +28,11 @@ let makeBoundTimedCollector = function(isIndexing, timeout, callback) { } function getQueue(){ - return messagesData + return messagesData; } function resetQueue(){ - messagesData = [] + messagesData = []; } }; diff --git a/js/search/search.js b/js/search/search.js index 9c12b4f1..8311a6b0 100644 --- a/js/search/search.js +++ b/js/search/search.js @@ -140,6 +140,7 @@ class Search { if (err) { log.send(logLevels.ERROR, 'Error indexing the batch ->' + err); reject(new Error(err)); + return; } resolve(res); }); @@ -156,6 +157,7 @@ class Search { if (err) { log.send(logLevels.ERROR, 'Error merging the index ->' + err); reject(new Error(err)); + return; } libSymphonySearch.symSERemoveFolder(this.batchIndex); resolve(res); @@ -163,12 +165,22 @@ class Search { }); } + /** + * Batching the real time + * messages for queue and flush + * @param {Object} message + */ batchRealTimeIndexing(message) { this.collector(message); } + /** + * Returns the current state of the + * real-time indexing + * @returns {boolean} + */ checkIsRealTimeIndexing() { - return this.isRealTimeIndexing + return this.isRealTimeIndexing; } /**