createResponse([$stopwatch]); } public function searchRawAction(Request $request) { $stopwatch = new Stopwatch("controller"); list($offset, $limit) = V3ResultHelpers::paginationFromRequest($request); $options = SearchEngineOptions::fromRequest($this->app, $request); $options->setFirstResult($offset); $options->setMaxResults($limit); $stopwatch->lap("set options"); $se = $this->getSearchEngine(); $stopwatch->lap("getSearchEngine"); $se->resetCache(); $stopwatch->lap("resetCache"); $search_result = $se->queryraw((string)$request->get('query'), $options); $stopwatch->lap("queryraw"); // queryraw returns also a stopwatch, get and remove it $stopwatch_es = $search_result['__stopwatch__']; unset($search_result['__stopwatch__']); $this->getSearchEngine()->clearCache(); $result = Result::create($request, $search_result); $stopwatch->lap("Result::create"); return $result->createResponse([$stopwatch, $stopwatch_es]); } /** * // return SearchEngineInterface * @return ElasticSearchEngine */ private function getSearchEngine() { return $this->app['phraseanet.SE']; } }