chg: [performance] Reworked the pre-fetching of event IDs for the events/restSearch endpoint

- no need to count all existing hits in a non paginated situation. Simply use the result count
pull/4529/head
iglocska 2019-04-23 10:54:49 +02:00
parent 5a3d36eb76
commit 615f92e41a
1 changed files with 6 additions and 4 deletions

View File

@ -1520,17 +1520,18 @@ class Event extends AppModel
'recursive' => -1,
'fields' => $fields
);
// Get the count (but not the actual data) of results for paginators
$result_count = $this->find('count', $find_params);
if (isset($params['limit'])) {
// Get the count (but not the actual data) of results for paginators
$result_count = $this->find('count', $find_params);
$find_params['limit'] = $params['limit'];
if (isset($params['page'])) {
$find_params['page'] = $params['page'];
}
}
$results = $this->find('list', $find_params);
if (!isset($params['limit'])) {
$result_count = count($results);
}
return $results;
}
@ -5936,6 +5937,7 @@ class Event extends AppModel
}
$filters['include_attribute_count'] = 1;
$eventid = $this->filterEventIds($user, $filters, $elementCounter);
throw new Exception();
$eventCount = count($eventid);
$eventids_chunked = $this->__clusterEventIds($exportTool, $eventid);
unset($eventid);