@param Request $request
@param array $query

@return Request
199251
private function addQueryParameters(Request $request, array $query)
    {
        $request->query->add($query);
        $request->server->add(['QUERY_STRING' => http_build_query($query)]);

        return $request;
    }
1291066
public function search($query)
    {
        try {
            $request = $this->client->createRequest($query);
            $response = $this->executeRequest($request);
            $this->hasSearched = true;
            $this->responseCache = $response;
        } catch (HttpException $e) {
            $this->handleErrorResponses($e);
        }
        return $response;
    }
418269
public function queryParams(array $query)
	{
		$this->query = Arrays::mergeDeep($this->query, $query);
		
		return $this;
	}
1328229
public function send(Request $request)
    {
        $response     = new SearchResponse();
        $httpRequest  = $this->createHttpRequest($request);
        $httpResponse = $this->client->send($httpRequest);
        $json         = $httpResponse->json();
        $result       = $json['response'];

        $response->docs     = $result['docs'];
        $response->numFound = $result['numFound'];
        $response->maxScore = $result['maxScore'];
        $response->docs     = array_map([$this, 'docToArray'], $result['docs']);

        return $response;
    }
318251
public static function generateFromRequest(Request $request, array $mapping = array())
    {
        $configuration = new static();

        $configuration->setPaginateConfiguration(
            $request->get('order'),
            $request->get('start'),
            $request->get('length'),
            $mapping,
            $request->get('search')
        );

        return $configuration;
    }
929709
protected function search(Builder $query, Request $request): Builder
    {
        $phrase = $request->input('q');

        if (!$phrase || strlen($phrase) < $this->minimumSearchInputLength) {
            return $query;
        }

        if ($this->translationModel()) {
            return $this->searchQueryTranslations($query, $phrase);
        }

        return $this->searchQuery($query, $phrase);
    }
1318555
public function createRequestUri($name, array $query = array())
    {
        if (empty($this->routeMapping[$name])) {
            throw new \InvalidArgumentException(sprintf('Unknow request preset under name "%s", only [%s] defined.',
                $name,
                implode('","', array_keys($this->routeMapping))
            ));
        }

        // build request
        return $this->urlGenerator->generate(
            $this->routeMapping[$name],
            $query,
            UrlGeneratorInterface::ABSOLUTE_URL
        );
    }
455835
public function prepare(array $query)
    {
        $client = new Client;

        $this->client  = $client;
        $this->request = $client->createRequest(
            $this->prepareMethod($query),
            $this->prepareRequestUrl($query),
            [
                'headers' => $this->prepareHeaders($query),
                'body'    => $this->prepareBody($query),
            ]
        );

        return $this;
    }
171858
public function addQuery(array $query)
    {
        $queryParts = [];
        foreach ($query as $key => $value) {
            $queryParts[] = "{$key}={$value}";
        }

        $this->fullUrl['query'] = '?' . implode('&', $queryParts);

        return $this;
    }
70869
public function get($url, array $query = [])
    {
        $url = $this->buildUrl($url, $query);
        $handle = $this->getHandler();

        return $this->run($handle, $url);
    }
1037099
public function query($query) {
		$args = func_get_args();
		$query = array_shift($args);
		return $this->execute($query, $args);
	}
389819
public function getResponse(array $query = array())
    {
        $headers = $this->headers;
        $json = null;
        
        if ($this->json) {
            $json   = json_encode($query);
            $query  = array();
        }
        
        //get the authorization parameters as an array
        $signature = $this->getSignature($query);
        $authorization  = $this->getAuthorization($signature, false);
        
        //if we should use the authrization
        if ($this->useAuthorization) {
            //add the string to headers
            $headers[] = sprintf(self::AUTH_HEADER, $this->buildQuery($authorization, ',', false));
        } else {
            //merge authorization and query
            $query = array_merge($authorization, $query);
        }
        
        $query = $this->buildQuery($query);
        $url = $this->url;
        
        //set curl
        $curl = Curl::i()->verifyHost(false)->verifyPeer(false);
        
        //if post
        if ($this->method == self::POST) {
            $headers[] = self::POST_HEADER;
            
            if (!is_null($json)) {
                $query = $json;
            }
            
            //get the response
            $response = $curl->setUrl($url)
                ->setPost(true)
                ->setPostFields($query)
                ->setHeaders($headers)
                ->getResponse();
        } else {
            if (trim($query)) {
                //determine the conector
                $connector = null;
                
                //if there is no question mark
                if (strpos($url, '?') === false) {
                    $connector = '?';
                //if the redirect doesn't end with a question mark
                } else if (substr($url, -1) != '?') {
                    $connector = '&';
                }
                
                //now add the secret to the redirect
                $url .= $connector.$query;
            }
            
            //get the response
            $response = $curl->setUrl($url)->setHeaders($headers)->getResponse();
        }
        
        $this->meta = $curl->getMeta();
        $this->meta['url'] = $url;
        $this->meta['authorization'] = $authorization;
        $this->meta['headers'] = $headers;
        $this->meta['query'] = $query;
        $this->meta['response'] = $response;
        
        return $response;
    }
1196804
public function scopeSearch($query, $request)
    {
        if (! empty($request->s)) {
            $query->where('first_name', 'like', '%' . $request->s . '%')
                    ->orWhere('last_name', 'like', '%' . $request->s . '%')
                    ->orWhere('email', 'like', '%' . $request->s . '%')
                    ->orWhere('phone', 'like', '%' . $request->s . '%');
        }

        if (isset($request->status) && $request->status === 'trashed') {
            $query->onlyTrashed();
        }

        return $query;
    }
726548
public function execute($params = array(), $request = array()) {
        //$passableParams = $this->httpRequest->getParameters();
        //remove the uri
        // array_shift($passableParams);

        $this->getQueryBuilder()->where($params);
        $query = '';
        if ($this->entity instanceof AbstractI18nEntity) {
            $query = $this->getQueryBuilder()->getQuery($this->entity, QueryBuilder::GET_ITEM_QUERY, QueryBuilder::PARENT_AND_CHILD);
        } else {
            $query = $this->getQueryBuilder()->getQuery($this->entity, QueryBuilder::GET_ITEM_QUERY);
        }

        $firstResult = $this->query($query);
        $entityName = get_class($this->entity);

        if (is_array($firstResult) && count($firstResult) > 0) {

            $this->loadI18nValues($firstResult, $params);

            $this->loadChildTableParams($firstResult, $params);

            $this->loadOneToOneJoinTables($firstResult);

            $this->loadOneToManyJoinTables($firstResult, $params);


        }

        return array($entityName => is_array($firstResult) ? current($firstResult) : array());
    }
833663
public function search(Request $request): Response
    {
        $configResolver = $this->getConfigResolver();
        $queryType = $this->getQueryTypeRegistry()->getQueryType('NetgenSite:Search');

        $searchText = trim($request->query->get('searchText', ''));

        if (empty($searchText)) {
            return $this->render(
                $configResolver->getParameter('template.search', 'ngsite'),
                [
                    'search_text' => '',
                    'pager' => null,
                ]
            );
        }

        $pager = new Pagerfanta(
            new FindAdapter(
                $queryType->getQuery(['search_text' => $searchText]),
                $this->getSite()->getFindService()
            )
        );

        $pager->setNormalizeOutOfRangePages(true);
        $pager->setMaxPerPage((int) $configResolver->getParameter('search.default_limit', 'ngsite'));

        $currentPage = $request->query->getInt('page', 1);
        $pager->setCurrentPage($currentPage > 0 ? $currentPage : 1);

        return $this->render(
            $configResolver->getParameter('template.search', 'ngsite'),
            [
                'search_text' => $searchText,
                'pager' => $pager,
            ]
        );
    }
1356775
public function scopeFilter($query, $request)
    {
        $request = Arr::only($request, ['name', 'description']);

        $query->actives()->where(function ($query) use ($request) {
            foreach ($request as $key => $value) {
                $query->orWhere($key, 'like', '%' . $value . '%');
            }
            return $query;
        });

        return $query;
    }
621978
public function scopeRequestWith($query, Request $request)
    {
        if ($request->has('with')) {
            $query->with($request->input('with'));
        }

        return $query;
    }