Adds a query to a multi-query batch using current settings.

@param string $query   The query string that we are searching for.
@param array  $indexes The indexes to perform the search on.
547439
public function addQuery($query, array $indexes)
    {
        $indexNames = '';
        foreach ($indexes as &$label) {
            if (isset($this->indexes[$label])) {
                $indexNames .= $this->indexes[$label] . ' ';
            }
        }

        if (!empty($indexNames)) {
            $this->sphinx->addQuery($query, $indexNames);
        }
    }
943028
protected function setQueryParams(array $params)
    {
        foreach ($params as $key => $value) {
            $this->setQueryParam($key, $value);
        }
    }
1374911
public function setQuery($query)
    {
        if (!($query instanceof QueryString)) {
            $this->query = new QueryString($query);

            return $this;
        }

        $this->query = $query;

        return $this;
    }
1366413
protected function addCriteriaToPositionQuery($query)
    {
        // Find products in the same category
        $products = ProductCategoryQuery::create()
            ->filterByCategoryId($this->getDefaultCategoryId())
            ->filterByDefaultCategory(true)
            ->select('product_id')
            ->find();

        if ($products != null) {
            $query->filterById($products, Criteria::IN);
        }
    }
171858
public function addQuery(array $query)
    {
        $queryParts = [];
        foreach ($query as $key => $value) {
            $queryParts[] = "{$key}={$value}";
        }

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

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

        foreach ($query as $key => $value)
        {
            $q[$key] = $value;
        }
    }
1042904
public function addQueries(array $queries) : self
    {
        foreach ($queries as $key => $value) {
            if (is_null($value)) {
                continue;
            }

            if (!is_string($key)) {
                throw new \InvalidArgumentException("Invalid querystring '" . $key . "'");
            }

            if (!is_string($value) && !is_array($value)) {
                throw new \InvalidArgumentException(sprintf(
                    "Invalid querystring value '%s' with type '%s'",
                    $key,
                    gettype($value)
                ));
            }

            $this->uri['query'][$key] = $value;
        }

        return $this;
    }
612442
public function batchSearch(array $queries) {
        $requests = [];

        foreach ($queries as $query) {
            $requests[] = [
                'method' => 'idoit.search',
                'params' => [
                    'q' => $query
                ]
            ];
        }

        return $this->api->batchRequest($requests);
    }
1042739
protected function addSelectsToQuery(Builder $query, array $selects)
    {
        if (!empty($selects)) {
            $query->selectRaw('max(' . implode(' + ', $selects) . ') as relevance', $this->searchBindings);
        }
    }
672870
public function setQuery($query = null)
    {
        $this->query = [];
        return ($query === null)
            ? $this
            : $this->addQueryData($query);
    }
886150
protected function applyQuerySettings($query, array $settings) {
    if (!empty($settings)) {
      $respectStoragePage = $settings['respectStoragePage'];

      if (is_bool($respectStoragePage)) {
        $query->getQuerySettings()->setRespectStoragePage($respectStoragePage);
      }

      $respectSysLanguage = $settings['respectSysLanguage'];

      if (is_bool($respectSysLanguage)) {
        $query->getQuerySettings()->setRespectSysLanguage($respectSysLanguage);
      }

      $returnRawQueryResult = $settings['returnRawQueryResult'];

      if (is_bool($returnRawQueryResult)) {
        $query->getQuerySettings()->setReturnRawQueryResult($returnRawQueryResult);
      }
    }

    return $query;
  }
430525
private function setMatchedQuery( $matches = [ ], $query = '' ) {
        if ( ! is_null( $this->matched_rule ) ) {
            $mathed = \WP_MatchesMapRegex::apply( preg_replace( "!^.+\?!", '', $query ), $matches );
            $this->matched_query = addslashes( $mathed );
            parse_str( $this->matched_query, $this->perma_q_vars );
            if ( '404' === $this->error ) $this->error = NULL;
        }
    }
106995
protected static function multiQuery(string $queries): void
  {
    if (self::$logQueries)
    {
      $time0 = microtime(true);

      $tmp = self::$mysqli->multi_query($queries);
      if ($tmp===false)
      {
        throw new DataLayerException(self::$mysqli->errno, self::$mysqli->error, $queries);
      }

      self::$queryLog[] = ['query' => $queries, 'time' => microtime(true) - $time0];
    }
    else
    {
      $tmp = self::$mysqli->multi_query($queries);
      if ($tmp===false)
      {
        throw new DataLayerException(self::$mysqli->errno, self::$mysqli->error, $queries);
      }
    }
  }
1020563
public function bind(string $query, array $bindings): string
    {
        $this->checkBindings($query, $bindings);
        $bindings = $this->escapeBindings($bindings);

        foreach ($bindings as $key => $value) {
            if (substr($key, 0, 1) !== ':') {
                $key = ':'.$key;
            }

            $query = str_replace($key, $value, $query);
        }

        return $query;
    }
1162058
public function addIndex($indexName) {
    if (is_array($indexName)) {
      $this->indexes = $indexName;
    } else {
      $this->indexes[] = $indexName;
    }
    $this->indexes = array_unique($this->indexes);
  }
222833
private function expandQueryIndexes(SearchQuery $query)
    {
        $expandedIndexes = [];

        foreach ($query->getIndexes() as $index) {
            foreach ($this->getDecoratedIndexNames($index, $query->getLocale()) as $expandedIndex) {
                $expandedIndexes[$expandedIndex] = $expandedIndex;
            }
        }

        $query->setIndexes($expandedIndexes);
    }
1093417
protected function process_query(Query $query, array $columns = [], array $defaults = [])
	{
		// Count all items
		$all_items_count = $query->count();

		// Process incoming sorting values
		$sort = [];
		for ($i = 0; $i < \Input::param('iSortingCols'); $i++)
		{
			$sort[\Input::param('iSortCol_'.$i)] = \Input::param('sSortDir_'.$i);
		}

		$i = 0;
		$order_by = [];
		$where = [];
		$global_filter = \Input::param('sSearch');

		foreach ($columns as $key => $value)
		{
			$rels = explode('.', $key);

			$rel = '';

			for ($j=0; $j < count($rels) - 1 and count($rels) > 1; $j++)
			{
				$rel .= '.' . $rels[$j];
				$query->related($rel);
			}

			$value = \Arr::merge($defaults, $value);

			if ($eav = \Arr::get($value, 'eav', false))
			{
				$query->related($rel . '.' . $eav);
			}

			// Order by statement
			if (\Input::param('bSortable_'.$i, true) and \Arr::get($value, 'sort', true) and array_key_exists($i,  $sort))
			{
				$order_by[$key] = $sort[$i];
			}

			$filter = \Input::param('sSearch_'.$i);

			$filter = json_decode($filter);

			if ( ! in_array($filter, array(null, '', 'null')) and \Input::param('bSearchable_'.$i, true) and \Arr::get($value, 'search', true))
			{
				switch (\Arr::get($value, 'type', 'text'))
				{
					case 'select-multiple':
					case 'select':
					case 'enum':
						$query->where($key, 'IN', $filter);
						break;
					case 'select-single':
					case 'number':
						$query->where($key, $filter);
						break;
					case 'text':
						$query->where($key, 'LIKE', '%' . $filter . '%');
						break;
					case 'range':
						$query->where($key, 'BETWEEN', $filter);
						break;
					default:
						break;
				}
			}

			if ( ! empty($global_filter))
			{
				if (\Arr::get($value, 'search', true) === true and \Arr::get($value, 'global', true) === true)
				{
					$where[] = array($key, 'LIKE', '%' . $global_filter . '%');
				}
			}

			$i++;
		}

		if ( ! empty($where))
		{
			$query->where_open();
			foreach ($where as $where)
			{
				$query->or_where($where[0], $where[1], $where[2]);
			}
			$query->where_close();
		}

		// Order query
		$query->order_by($order_by);

		$partial_items_count = $query->count();

		// Limit query
		$query
			->limit(\Input::param('iDisplayLength', 10))
			->offset(\Input::param('iDisplayStart', 0));

		return array($all_items_count, $partial_items_count);
	}