Search across the index types.

@param Query $query
@param array $parameters

@return Result
482168
public function query(
        Query $query,
        array $parameters = []
    ): Result {
        $resultingItems = $this->items[$this->getIndexKey()] ?? [];

        if (!empty($query->getFilters())) {
            foreach ($query->getFilters() as $filter) {
                if (Filter::TYPE_QUERY === $filter->getFilterType() && $filter->getValues() === ['']) {
                    continue;
                }

                if ('_id' !== $filter->getField()) {
                    throw new LogicException('Queries by field different than UUID not allowed in InMemoryRepository. Only for testing purposes.');
                }

                $resultingItems = [];
                $itemUUIDs = $filter->getValues();
                foreach ($itemUUIDs as $itemUUID) {
                    $resultingItems[$itemUUID] = $this->items[$this->getIndexKey()][$itemUUID] ?? null;
                }
            }
        }

        $resultingItems = array_values(
            array_slice(
                array_filter($resultingItems),
                $query->getFrom(),
                $query->getSize()
            )
        );

        $items = $this->items[$this->getIndexKey()] ?? [];
        $result = new Result($query->getUUID(), count($items), count($resultingItems));
        foreach ($resultingItems as $resultingItem) {
            $result->addItem($resultingItem);
        }

        return $result;
    }
1214782
public function search(string $query, array $arguments = null)
    {
        $args = ['q' => $query];
        if (is_array($arguments)) {
            $args = array_merge($arguments, $args);
        }
        return new SearchIterator($this, 'search/tweets', $args);
    }
735130
public function executeAndFetchArray($query, $parameters = [])
    {
        $statement = $this->link->prepare($query);

        $statement->execute($parameters);
        $data = $statement->fetch(PDO::FETCH_COLUMN);
        $statement->closeCursor();

        return $data;
    }
1055731
public function findSearch(Query $query, array $options) : Query
    {
        $search = new Search($query, $this->getTable());

        $search->setConjunction(Hash::get($options, 'conjunction', Search::DEFAULT_CONJUNCTION));

        foreach (Hash::get($options, 'data', []) as $criteria) {
            if (! is_array($criteria)) {
                throw new \InvalidArgumentException(sprintf(
                    'Search criteria must be an array, %s provided instead',
                    gettype($criteria)
                ));
            }

            $search->addCriteria(new Criteria($criteria));
        }

        return $search->execute();
    }
178047
public function search($query)
    {
        $this->logger->debug('Page:search');
        if (!Tools::isGoodString($query)) {
            $this->logger->error('Page::search: invalid query');
            return [];
        }
        $this->setGeneratorSearch($query, self::PAGE_NAMESPACE);
        $this->setParam('prop', 'pageprops');
        $this->send();
        return Tools::flatten($this->getResponse(['query', 'pages']));
    }
1045300
public function sendReadQuery($query, array $parameters = array())
    {
        return $this->sendCypherQuery($query, $parameters, $this->getReadConnection()->getAlias(), self::READ_QUERY);
    }
494840
public static function getIndexRecords($request, $parameters)
    {
        $instance = new static;

        if(method_exists($instance, 'addToGetIndexRecords'))
            $query = $instance->addToGetIndexRecords($request, $parameters);
        else
            if(method_exists($instance, 'scopeBuilder'))
                $query = $instance->builder();
            else
                $query = $instance->query();

        $query = Miscellaneous::getQueryWhere($request, $query, $parameters);

        if(isset($parameters['count']) &&  $parameters['count'])
        {
            // if we need count results
            if(method_exists($instance, 'customCountIndexRecords'))
                return $instance->customCountIndexRecords($query, $parameters);
            else
                return $query->count();
        }
        else
        {
            // if we need limit and order results
            if(isset($parameters['length']))
                $query->take($parameters['length']);

            if(isset($parameters['start']))
                $query->skip($parameters['start']);

            if(isset($parameters['order']) && is_array($parameters['order']))
                $query->orderBy($parameters['order']['column'], isset($parameters['order']['dir'])? $parameters['order']['dir'] : 'asc');


            if(method_exists($instance, 'getCustomReturnIndexRecords'))
            {
                // if we need a custom get()
                return $instance->getCustomReturnIndexRecords($query, $parameters);
            }
            else
            {
                // if has diplayColumns variable
                if(isset($parameters['displayColumns']) && is_array($parameters['displayColumns']) && count($parameters['displayColumns']) > 0)
                    return $query->get($parameters['displayColumns']);
                else
                    return $query->get();
            }
        }
    }
749725
public function searchMovies($query, array $parameters = [], array $headers = [])
    {
        return $this->get('search/movie', array_merge($parameters, [
            'query' => $query
        ], $headers));
    }
1188224
public function query($query, array $params = [])
    {
        $this->query  = $query;
        $this->params = $params;
        $this->send();

        return $this;
    }
90438
public function search($query, $options = [])
    {
        $url = $this->instanceURLRepo->get();
        $url .= $this->resourceRepo->get('search');
        $url .= '?q=';
        $url .= urlencode($query);

        $searchResults = $this->request($url, $options);

        return $searchResults;
    }
1089449
public function replaceQueryParameters($query, $parameters)
    {
        if ($parameters instanceof Data) {
            $parameters = $parameters->getValue(true);
        }

        $i = 0;

        if (! array_key_exists(0, $parameters) && array_key_exists(1, $parameters)) {
            $i = 1;
        }

        return preg_replace_callback(
            '/\?|((?<!:):[a-z0-9_]+)/i',
            static function ($matches) use ($parameters, &$i) {
                $key = substr($matches[0], 1);

                if (! array_key_exists($i, $parameters) && ($key === false || ! array_key_exists($key, $parameters))) {
                    return $matches[0];
                }

                $value  = array_key_exists($i, $parameters) ? $parameters[$i] : $parameters[$key];
                $result = DoctrineExtension::escapeFunction($value);
                $i++;

                return $result;
            },
            $query
        );
    }
412933
public function search($query) {
        if ($result = parent::search($query)) {
            return $result;
        }

        $found = false;

        foreach (core_component::get_plugin_list($this->subtype) as $name => $notused) {
            if (strpos(core_text::strtolower(get_string('pluginname', $this->subtype . '_' . $name)),
                    $query) !== false) {
                $found = true;
                break;
            }
        }
        if ($found) {
            $result = new stdClass();
            $result->page     = $this;
            $result->settings = array();
            return array($this->name => $result);
        } else {
            return array();
        }
    }
718238
public function fetchPairs($query, array $parameters = array())
    {
        $parameters = $this->parameterTransformer->transform($parameters);
        return $this->db->fetchPairs($query, $parameters);
    }
436120
public function searchCompany($query, CompanySearchQuery $parameters, array $headers = [])
    {
        $data = $this->getApi()->searchCompany($query, $this->getParameters($parameters), $headers);

        return $this->getCompanyFactory()->createResultCollection($data);
    }
1194842
public function convertToSql(String $query, Parameters $parameterRepository) : StdClass
	{
		$stdClass = new StdClass();
		$stdClass->parameterValues = [];
		$placeholder = '?';
		$stdClass->query = '';
		$match = false;

		if (preg_match_all('/\:([^ ,]+)/s', $query, $matched)) {
			$stdClass->parameterValues = array_map(function($value) use ($parameterRepository, $matched) {
				$value = str_replace(',', '', $value);
				if ($parameterRepository->getParameter($value) == null) {
					throw new InvalidParameterCountException(
						'Number of parameters does not match length of proposed parameters.',
						$matched[1],
						$parameterRepository
					);
				}

				return $parameterRepository->getParameter($value);
			}, $matched[1]);
		}

		$stdClass->query = str_replace($matched[0], '?', $query);

		if (sizeof($stdClass->parameterValues) < 1) {
			$stdClass->parameterValues = array_values($parameterRepository->getAll());
		}

		return $stdClass;
	}
343867
public function lists($page = 1, $query = null, array $params = [])
    {
        $this->listPage = $page;
        $this->listQuery = $query;
        $this->listParams = $params;

        return $this->getList();
    }
1273110
public function search($query)
    {
        $endpoint = $this->endpoint . '/search';

        $params = array_merge($this->prepareParams(), ['query' => $query]);

        $response = $this->restClient->get($endpoint, $params);

        return $response['body'];
    }