public function exportSearch(string $id, string $filename)
    {
        $filename = '' === trim($filename) ? $this->name : $filename;
        $export = new Export($id, $filename, $this->Auth->user());

        if ($this->request->is('ajax') && $this->request->accepts('application/json')) {
            $page = (int)Hash::get($this->request->getQueryParams(), 'page', 1);
            $limit = (int)Hash::get($this->request->getQueryParams(), 'limit', Configure::read('Search.export.limit'));

            $export->execute($page, $limit);

            $result = [
                'success' => true,
                'data' => ['path' => $export->getUrl()],
                '_serialize' => ['success', 'data']
            ];

            $this->set($result);

            return;
        }

        $this->set('count', $export->count());
        $this->set('filename', $filename);
        $this->render('Search.Search/export');
    }