Grab page limit from scout config
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is failing Details

This commit is contained in:
philipp lang 2024-05-09 02:23:55 +02:00
parent b1581bf9c8
commit 30d670a575
2 changed files with 9 additions and 1 deletions

View File

@ -6,6 +6,7 @@ use App\Member\FilterScope;
use App\Member\Member;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\Storage;
use Laravel\Scout\EngineManager;
use League\Csv\Writer;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
@ -43,7 +44,7 @@ class ExportAction
public function asController(ActionRequest $request): StreamedResponse
{
$members = FilterScope::fromRequest($request->input('filter'))->withOptions(['hitsPerPage' => 20000])->getQuery()->get();
$members = FilterScope::fromRequest($request->input('filter'))->noPageLimit()->getQuery()->get();
$contents = $this->handle($members);
Storage::disk('temp')->put('mitglieder.csv', $contents);

View File

@ -59,6 +59,13 @@ class FilterScope extends ScoutFilter
return $this;
}
public function noPageLimit(): self
{
return $this->withOptions([
'hitsPerPage' => config('scout.meilisearch.index-settings.' . Member::class . '.pagination.maxTotalHits')
]);
}
public function getQuery(): Builder
{
$this->search = $this->search ?: '';