From c91fd58ec6df949ce45b18abeafa0685e569ccdf Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Fri, 26 Oct 2018 15:08:14 -0400 Subject: [PATCH] fix(log): replace brittle string extraction --- controller/search.js | 2 +- controller/search_with_ids.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/controller/search.js b/controller/search.js index 31be742e..6bd03b6e 100644 --- a/controller/search.js +++ b/controller/search.js @@ -116,7 +116,7 @@ function setup( apiConfig, esclient, query, should_execute ){ logger.info(messageParts.join(' ')); debugLog.push(req, {queryType: { [renderedQuery.type] : { - es_result_count: parseInt(messageParts[2].slice(17, -1)) + es_result_count: _.get(res, 'data', []).length } }}); } diff --git a/controller/search_with_ids.js b/controller/search_with_ids.js index d6189beb..d4bb0510 100644 --- a/controller/search_with_ids.js +++ b/controller/search_with_ids.js @@ -115,7 +115,7 @@ function setup( apiConfig, esclient, query, should_execute ){ logger.info(messageParts.join(' ')); debugLog.push(req, {queryType: { [renderedQuery.type] : { - es_result_count: parseInt(messageParts[2].slice(17, -1)) + es_result_count: docs.length } }});