'meilisearch', 'description' => 'meilisearch' ]; } public function onRun() { $this->posts = $this->listPosts(); //$this->page = $this->listPosts(); } protected function listPosts() { $query = get('q'); $page = get('page'); //dd($query); if(is_null($page)) { $page = 1; } if(is_null($query)) { $query = 'здравоохранения'; } $this->page = $page; $this->query = $query; $per_page = 2; $offset=$per_page * ($page - 1); $client = new Client([ 'headers' => [ 'Content-Type' => 'application/json' ] ]); $response = $client->post('http://localhost:7700/indexes/posts_index/search', ['body' => json_encode( [ 'q' => $query, 'limit' => $per_page, 'offset' => $offset + $per_page, ] )] ); $res = json_decode($response->getBody()->getContents()); //$query = post('query'); //dd($res); return $res->hits; } }