/**
  * Builds search request according to given filters.
  *
  * @param Request $request
  *
  * @return SearchRequest
  */
 public function buildSearchRequest(Request $request)
 {
     $search = new SearchRequest();
     /** @var FilterInterface[] $filters */
     $filters = $this->all();
     foreach ($filters as $name => $filter) {
         $state = $filter->getState($request);
         $state->setName($name);
         $search->set($name, $state);
     }
     return $search;
 }