mirror of
https://github.com/flarum/core.git
synced 2025-07-24 10:11:43 +02:00
Remove total results from discussion searching
It’s too inefficient (requires a whole table scan) to do a query like: select count(*) from discussions where [conditions determining visibility]
This commit is contained in:
@@ -74,11 +74,7 @@ class IndexAction extends SerializeCollectionAction
|
||||
$load = array_merge($request->include, ['state']);
|
||||
$results = $this->searcher->search($criteria, $request->limit, $request->offset, $load);
|
||||
|
||||
if (($total = $results->getTotal()) !== null) {
|
||||
$response->content->addMeta('total', $total);
|
||||
}
|
||||
|
||||
static::addPaginationLinks($response, $request, route('flarum.api.discussions.index'), $total ?: $results->areMoreResults());
|
||||
static::addPaginationLinks($response, $request, route('flarum.api.discussions.index'), $results->areMoreResults());
|
||||
|
||||
return $results->getDiscussions();
|
||||
}
|
||||
|
Reference in New Issue
Block a user