Construct the query portion of the request body.
778101
private function constructQuery(\ECL\SymbolTable $table, array $filters, \ECL\Command\Elasticsearch\Agg $agg=null, array $settings=[]) {
        foreach($settings as $key=>$val) {
            $settings[$key] = $table->resolve($val);
        }
        $from = \ECL\Util::get($settings, 'from');
        $to = \ECL\Util::get($settings, 'to');

        $query_data = [
            'ignore_unavailable' => true,
            'body' => $this->constructQueryBody(
                $table, $filters, $agg,
                \ECL\Util::get($settings, 'fields'),
                \ECL\Util::get($settings, 'sort'),
                \ECL\Util::get($settings, 'size'),
                \ECL\Util::get($settings, 'date_field'),
                $from, $to
            )
        ];
        $query_settings = [
            'flatten' => \ECL\Util::get($settings, 'flatten', true),
            'scroll' => false,
            'count' => \ECL\Util::get($settings, 'count', false),
        ];

        // Optionally set index.
        if(array_key_exists('index', $settings)) {
            $index = $settings['index'];

            if(\ECL\Util::get($settings, 'date_based', false)) {
                $indices = \ECL\Util::generateDateIndices($index, \ECL\Util::get($settings, 'date_interval'), $from, $to);
                if(count($indices) == 0) {
                    throw new Exception('Empty index list');
                }
                $index = implode(',', $indices);
            }
            $query_data['index'] = $index;
        }

        return [$query_data, $query_settings];
    }
777464
def get_query_param(request, key):
    """"""
    value = request.query_params.get(key) or request.data.get(key)
    if value is None:
        raise KeyError()
    return value
983085
protected function assembleQuery() {
		if (empty($this->query)) {
			if ($this->queryRaw === null) {
				return '';
			}
			
			return $this->queryRaw;
		}
		
		return '?' . http_build_query($this->query);
	}
252030
private String getInboundRequestsWhere(Query query) {
        StringBuilder clause = new StringBuilder();
        clause.append("where d.owner_type = '" + OwnerType.LISTENER_REQUEST + "'\n");

        String find = query.getFind();
        Long id = query.getLongFilter("id");
        String path = query.getFilter("path");
        if (find != null) {
            try {
                Long docId = Long.parseLong(find);
                clause.append(" and d.document_id like '" + docId + "%'\n");
            }
            catch (NumberFormatException e) {
                clause.append(" and d.path like '" + find + "%'\n");
            }
        }
        else if (id != null && id > 0) {
            clause.append(" and d.document_id = " + id + "\n");
        }
        else if (path != null) {
            clause.append(" and d.path like '" + path + "%'\n");
        }
        else if (query.getFilter("ownerId") != null) {
            clause.append(" and d.owner_id = " + query.getLongFilter("ownerId") + "\n");
        }

        return clause.toString();
    }
513710
def doQuery(self, url, method='GET', getParmeters=None, postParameters=None, files=None, extraHeaders={}, session={}):
        """"""

        # Build headers
        headers = {}

        if not postParameters:
            postParameters = {}

        for key, value in extraHeaders.iteritems():
            # Fixes #197 for values with utf-8 chars to be passed into plugit
            if isinstance(value, basestring):
                headers['X-Plugit-' + key] = value.encode('utf-8')
            else:
                headers['X-Plugit-' + key] = value

        for key, value in session.iteritems():
            headers['X-Plugitsession-' + key] = value
            if 'Cookie' not in headers:
                headers['Cookie'] = ''
            headers['Cookie'] += key + '=' + str(value) + '; '

        if method == 'POST':
            if not files:
                r = requests.post(self.baseURI + '/' + url, params=getParmeters, data=postParameters, stream=True, headers=headers)
            else:
                # Special way, for big files
                # Requests is not usable: https://github.com/shazow/urllib3/issues/51

                from poster.encode import multipart_encode, MultipartParam
                from poster.streaminghttp import register_openers
                import urllib2
                import urllib

                # Register the streaming http handlers with urllib2
                register_openers()

                # headers contains the necessary Content-Type and Content-Length
                # datagen is a generator object that yields the encoded parameters
                data = []
                for x in postParameters:
                    if isinstance(postParameters[x], list):
                        for elem in postParameters[x]:
                            data.append((x, elem))
                    else:
                        data.append((x, postParameters[x]))

                for f in files:
                    data.append((f, MultipartParam(f, fileobj=open(files[f].temporary_file_path(), 'rb'), filename=files[f].name)))

                datagen, headers_multi = multipart_encode(data)

                headers.update(headers_multi)

                if getParmeters:
                    get_uri = '?' + urllib.urlencode(getParmeters)
                else:
                    get_uri = ''

                # Create the Request object
                request = urllib2.Request(self.baseURI + '/' + url + get_uri, datagen, headers)

                re = urllib2.urlopen(request)

                from requests import Response

                r = Response()
                r.status_code = re.getcode()
                r.headers = dict(re.info())
                r.encoding = "application/json"
                r.raw = re.read()
                r._content = r.raw

                return r

        else:
            # Call the function based on the method.
            r = requests.request(method.upper(), self.baseURI + '/' + url, params=getParmeters, stream=True, headers=headers, allow_redirects=True)

        return r
385206
public function buildQuery($query)
    {
        $q = $this->request->getQuery();

        foreach ($query as $key => $value)
        {
            $q[$key] = $value;
        }
    }
698105
private void parseQueryFormData() throws IOException {
        int size = getContentLength();
        if (0 == size) {
            // no body present
            this.queryParameters = new HashMap<String, String[]>();
            return;
        } else if (-1 == size) {
            // chunked encoded perhaps
            size = 1024;
        }
        StringBuilder sb = new StringBuilder(size);
        char[] data = new char[size];
        BufferedReader reader = getReader();
        int len = reader.read(data);
        while (-1 != len) {
            sb.append(data, 0, len);
            len = reader.read(data);
        }
        this.queryParameters = parseQueryString(sb.toString());
    }
1091990
private String extractQueryParam(HttpServletRequest request, Map<String, String> restParams) {
        String query = request.getQueryString();
        if (Utils.isEmpty(query)) {
            return "";
        }
        StringBuilder buffer = new StringBuilder(query);
        
        // Split query component into decoded, &-separate components.
        String[] parts = Utils.splitURIQuery(buffer.toString());
        List<Pair<String, String>> unusedList = new ArrayList<Pair<String,String>>();
        boolean bRewrite = false;
        for (String part : parts) {
            Pair<String, String> param = extractParam(part);
            switch (param.firstItemInPair.toLowerCase()) {
            case "api":
                bRewrite = true;
                restParams.put("api", param.secondItemInPair);
                break;
            case "format":
                bRewrite = true;
                if (param.secondItemInPair.equalsIgnoreCase("xml")) {
                    restParams.put("format", "text/xml");
                } else if (param.secondItemInPair.equalsIgnoreCase("json")) {
                    restParams.put("format", "application/json");
                }
                break;
            case "tenant":
                bRewrite = true;
                restParams.put("tenant", param.secondItemInPair);
                break;
            default:
                unusedList.add(param);
            }
        }
        
        // If we extracted any fixed params, rewrite the query parameter.
        if (bRewrite) {
            buffer.setLength(0);
            for (Pair<String, String> pair : unusedList) {
                if (buffer.length() > 0) {
                    buffer.append("&");
                }
                buffer.append(Utils.urlEncode(pair.firstItemInPair));
                if (pair.secondItemInPair != null) {
                    buffer.append("=");
                    buffer.append(Utils.urlEncode(pair.secondItemInPair));
                }
            }
        }
        return buffer.toString();
    }
367035
public function buildRequestParts(
        string $url,
        array $query = [],
        array $body = [],
        array $server = []
    ): RequestParts {
        $url = trim($url, '/');
        $url = trim("{$this->version}/$url", '/');
        $url = $this->buildUrlParams($url, $query);

        return new RequestParts(
            $url,
            [
                'json' => $body,
                'headers' => $server,
            ],
            [
                'decode_content' => 'gzip',
            ]
        );
    }
57796
def query(self):
        """"""

        if not hasattr(self, '_decoded_query'):
            self._decoded_query = list(urls._url_decode_impl(
                self.querystr.split('&'), 'utf-8', False, True, 'strict'))
        return self.query_cls(self._decoded_query)
318744
def construct_url(self):
        """"""
        path = [self.path]
        path.extend(self.params)

        # Build URL
        url = self.client.base_url + '/'.join(
            str(value) for value in path
            if value
        )

        # Append query parameters (if defined)
        query = self.encode_query(self.query)

        if query:
            url += '?' + query

        return url
1263699
def create_request(self, method='', url='', query_params=None, body=None, headers=None):
        

        if query_params:
            query = urlencode(query_params)
            if query:
                url = url + ('&' if url.find('?') > 0 else '?') + query

        content_type = None
        accept = None

        if headers is None:
            headers = {}

        it = iterator(headers)

        for key, value in it:
            if key.lower().find('content-type') >= 0:
                content_type = value
            if key.lower().find('accept') >= 0:
                accept = value

        if content_type is None:
            content_type = 'application/json'
            headers['Content-Type'] = content_type

        if accept is None:
            accept = 'application/json'
            headers['Accept'] = accept

        if content_type.lower().find('application/json') >= 0:
            body = json.dumps(body) if body else None
        elif content_type.lower().find('application/x-www-form-urlencoded') >= 0:
            body = urlencode(body) if body else None

        return requests.Request(method, url, headers=headers, data=body)
501618
function _buildQuery(){

            var url         = data.url;
            var cache       = typeof data.cache !== 'undefined' ? !!data.cache : true;
            var queryString = data.queryString || '';
            var _data       = data.data;

            //add a cache buster
            if(cache === false){
                queryString += '&ajabuster=' + new Date().getTime();
            }

            url = appendQueryString(url, queryString);

            if(_data && !_dataInBody()){
                url =  appendQueryString(url, _data);
            }
            return url;
        }
389353
private QueryRequest createQueryRequest(String[] elements) {
        QueryRequest request = QueryRequest.create();
        for (String element : elements) {
            String[] parts = StringUtils.split(element, ":", 2);
            parts[0] = parts[0].replace("\\", "\\\\");
            parts[1] = parts[1].replace("\\", "\\\\");
            request.addParameter(parts[0], parts[1].substring(1, parts[1].length() - 1));
        }
        return request;
    }
396382
def get_query_param(self, key, default=None):
        """"""
        value = self.request.query_params.get(key, None)
        if value is None:
            value = self.request.data.get(key, None)
        if value is None:
            value = default
        return value
1281091
def urlencoded(body, charset='ascii', **kwargs):
    """"""
    return parse_query_string(text(body, charset=charset), False)
374323
protected function buildQuery()
	{
		$this->setup();

		$query = array();

		// Index always needs to be provided. _all means a cross index search.
		$query['index'] = empty($this->indices) ? '_all' : implode(',', array_values($this->indices));

		// Type is not required, will search in the entire index.
		if (!empty($this->types)) {
			$query['type'] = implode(',', array_values($this->types));
		}

		// Replace Fragments with their raw body.
		$query['body'] = $this->fragmentParser->parse($this->body);

		// Add all query string params, the SDK will only add known params to the URL.
		foreach ($this->queryStringParams as $paramName => $paramValue) {
			$query[$paramName] = $paramValue;
		}

		return $query;
	}