protected function getAjaxViewVars(array $searchData, RepositoryInterface $table, Search $search): array
    {
        /** @var \Cake\ORM\Table */
        $table = $table;

        $searchData['sort_by_field'] = Hash::get($this->request->getQueryParams(), 'sort', '');
        $searchData['sort_by_order'] = Hash::get(
            $this->request->getQueryParams(),
            'direction',
            SearchOptions::DEFAULT_SORT_BY_ORDER
        );

        /** @var \Cake\ORM\Query */
        $query = $search->execute($searchData);
        $resultSet = $this->paginate($query);

        $event = new Event(
            (string)SearchEventName::MODEL_SEARCH_AFTER_FIND(),
            $this,
            ['entities' => $resultSet, 'table' => $table]
        );
        $this->getEventManager()->dispatch($event);
        $resultSet = $event->getResult() instanceof ResultSetInterface ? $event->getResult() : $resultSet;

        $primaryKeys = [];
        foreach ((array)$table->getPrimaryKey() as $primaryKey) {
            $primaryKeys[] = $table->aliasField($primaryKey);
        }

        $displayColumns = empty($searchData['group_by']) ?
            $searchData['display_columns'] :
            [$searchData['group_by'], pluginSplit($searchData['group_by'])[0] . '.' . Search::GROUP_BY_FIELD];
        $displayColumns = array_merge($primaryKeys, $displayColumns);

        return [
            'success' => true,
            'data' => Utility::instance()->formatter($resultSet, $displayColumns, $table, $this->Auth->user()),
            'pagination' => ['count' => $query->count()],
            '_serialize' => ['success', 'data', 'pagination']
        ];
    }