From 0a2bcca53e048ff1dcfa631ad6cfcbc5854c2746 Mon Sep 17 00:00:00 2001 From: jjrom Date: Sat, 9 Apr 2022 05:19:26 +0200 Subject: [PATCH] Major speed improvement in getCount when heatmapNoGeo is requested --- app/resto/core/dbfunctions/FeaturesFunctions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/resto/core/dbfunctions/FeaturesFunctions.php b/app/resto/core/dbfunctions/FeaturesFunctions.php index 8fea52e2..c56c0a6b 100755 --- a/app/resto/core/dbfunctions/FeaturesFunctions.php +++ b/app/resto/core/dbfunctions/FeaturesFunctions.php @@ -199,7 +199,8 @@ public function search($context, $user, $model, $collections, $params, $sorting) */ if ( isset($context->query['_heatmapNoGeo']) && filter_var($context->query['_heatmapNoGeo'], FILTER_VALIDATE_BOOLEAN) ) { $whereClause = $filtersFunctions->getWhereClause($filtersAndJoins, array('sort' => false, 'addGeo' => false)); - $heatmapLink = (new Heatmap($context, $user))->getEndPoint($featureTableName, $whereClause, $this->getCount('FROM ' . $featureTableName . ' ' . $whereClause, $params), $wkt); + // [IMPORTANT] Set empty $params in getCount() to avoid computation of real count + $heatmapLink = (new Heatmap($context, $user))->getEndPoint($featureTableName, $whereClause, $this->getCount('FROM ' . $featureTableName . ' ' . $whereClause), $wkt); } else { for ($i = count($filtersAndJoins['filters']); $i--;) {