/**
  * @param AbstractElasticaSearcher $searcher
  * @param Request                  $request
  * @param RenderContext            $context
  */
 protected function applySearchParams(AbstractElasticaSearcher $searcher, Request $request, RenderContext &$context)
 {
     // Retrieve the search parameters
     $queryString = trim($request->query->get('query'));
     $queryType = $request->query->get('type');
     $lang = $request->getLocale();
     $context['q_query'] = $queryString;
     $context['q_type'] = $queryType;
     $searcher->setData($this->sanitizeSearchQuery($queryString))->setContentType($queryType)->setLanguage($lang);
     $query = $searcher->getQuery();
     // Aggregations
     $termsAggregation = new Terms('type');
     $termsAggregation->setField('type');
     $query->addAggregation($termsAggregation);
 }
 /**
  * @param int|null $offset
  * @param int|null $size
  * @return \Elastica\ResultSet
  */
 public function search($offset = null, $size = null)
 {
     $this->language = $this->currentLocale->getCurrentLocale();
     return parent::search($offset, $size);
 }