@param SearchNodesRequest $request
@param ParsedQuery        $parsedQuery

@return SchemaQName[]
6270
protected function createQNamesForSearchNodes(SearchNodesRequest $request, ParsedQuery $parsedQuery): array
    {
        $curie = $request::schema()->getCurie();
        $vendor = $curie->getVendor();
        // converts search-articles-request to "article"
        // converts search-categories-request to "category"
        $label = str_replace(['search-', 'ies-request', 's-request'], ['', 'y', ''], $curie->getMessage());

        // todo: use an inflector here for better default qname factory
        if ('people-request' === $label) {
            $label = 'person';
        }

        return [SchemaQName::fromString("{$vendor}:{$label}")];
    }
987481
public function search(Request $request, array $contenttypes = null)
    {
        $q = '';
        $context = __FUNCTION__;

        if ($request->query->has('q')) {
            $q = $request->query->get('q');
        } elseif ($request->query->has($context)) {
            $q = $request->query->get($context);
        }
        $q = Input::cleanPostedData($q, false);

        $page = $this->app['pager']->getCurrentPage($context);

        // Theme value takes precedence over default config @see https://github.com/bolt/bolt/issues/3951
        $pageSize = $this->getOption('theme/search_results_records', false);
        if ($pageSize === false && !$pageSize = $this->getOption('general/search_results_records', false)) {
            $pageSize = $this->getOption('theme/listing_records', false) ?: $this->getOption('general/listing_records', 10);
        }

        $offset = ($page - 1) * $pageSize;
        $limit = $pageSize;

        // set-up filters from URL
        $filters = [];
        foreach ($request->query->all() as $key => $value) {
            if (strpos($key, '_') > 0) {
                list($contenttypeslug, $field) = explode('_', $key, 2);
                if (isset($filters[$contenttypeslug])) {
                    $filters[$contenttypeslug][$field] = $value;
                } else {
                    $contenttype = $this->getContentType($contenttypeslug);
                    if (is_array($contenttype)) {
                        $filters[$contenttypeslug] = [
                            $field => $value,
                        ];
                    }
                }
            }
        }
        if (count($filters) == 0) {
            $filters = null;
        }

        $isLegacy = $this->getOption('general/compatibility/setcontent_legacy', true);
        if ($isLegacy) {
            $result = $this->storage()->searchContent($q, $contenttypes, $filters, $limit, $offset);

            /** @var \Bolt\Pager\PagerManager $manager */
            $manager = $this->app['pager'];
            $manager
                ->createPager($context)
                ->setCount($result['no_of_results'])
                ->setTotalpages(ceil($result['no_of_results'] / $pageSize))
                ->setCurrent($page)
                ->setShowingFrom($offset + 1)
                ->setShowingTo($offset + ($result ? count($result['results']) : 0));
            ;

            $manager->setLink($this->generateUrl('search', ['q' => $q]) . '&page_search=');
        } else {
            $appCt = array_keys($this->app['query.search_config']->getSearchableTypes());
            $textQuery = '(' . join(',', $appCt) . ')/search';
            $params = [
                'filter' => $q,
                'page'   => $page,
                'limit'  => $pageSize,
            ];
            $searchResult = $this->getContent($textQuery, $params);

            $result = [
                'results' => $searchResult->getSortedResults(),
                'query'   => [
                    'sanitized_q' => strip_tags($q),
                ],
            ];
        }

        $globals = [
            'records'      => $result['results'],
            $context       => $result['query']['sanitized_q'],
            'searchresult' => $result,
        ];

        $template = $this->templateChooser()->search();

        return $this->render($template, [], $globals);
    }
1305723
@Transactional
    public List<E> find(E entity, SearchParameters sp) {
        if (sp.hasNamedQuery()) {
            return byNamedQueryUtil.findByNamedQuery(sp);
        }
        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
        CriteriaQuery<E> criteriaQuery = builder.createQuery(type);
        if (sp.getDistinct()) {
            criteriaQuery.distinct(true);
        }
        Root<E> root = criteriaQuery.from(type);

        // predicate
        Predicate predicate = getPredicate(criteriaQuery, root, builder, entity, sp);
        if (predicate != null) {
            criteriaQuery = criteriaQuery.where(predicate);
        }

        // fetches
        fetches(sp, root);

        // order by
        criteriaQuery.orderBy(orderByUtil.buildJpaOrders(sp.getOrders(), root, builder, sp));

        TypedQuery<E> typedQuery = entityManager.createQuery(criteriaQuery);
        applyCacheHints(typedQuery, sp);
        jpaUtil.applyPagination(typedQuery, sp);
        List<E> entities = typedQuery.getResultList();
        log.fine("Returned " + entities.size() + " elements");

        return entities;
    }
638484
protected function getParsedSearchResults($resultSet)
    {
        /** @var ResultParserRegistry $parserRegistry */
        $parserRegistry = GeneralUtility::makeInstance(ResultParserRegistry::class, /** @scrutinizer ignore-type */ $this->typoScriptConfiguration);
        $useRawDocuments = (bool)$this->typoScriptConfiguration->getValueByPathOrDefaultValue('plugin.tx_solr.features.useRawDocuments', false);
        $parserRegistry->getParser($resultSet)->parse($resultSet, $useRawDocuments);
    }
851705
private function parseFilters(\DOMXPath $xpath, \DOMNode $requestRootNode)
    {
        $filters = [];

        foreach ($xpath->query(self::FILTERS_PATH, $requestRootNode) as $filterNode) {
            $filters[$filterNode->getAttribute('name')] = $filterNode->nodeValue;
        }

        return $filters;
    }
451380
public function searchKeyword($query, KeywordSearchQuery $parameters, array $headers = [])
    {
        $data = $this->getApi()->searchKeyword($query, $this->getParameters($parameters), $headers);

        return $this->getKeywordFactory()->createResultCollection($data);
    }
23432
public function searchAction(Request $request, $string)
    {
        $ret = [];

        foreach ($this->getFinderRegistry()->all() as $searcher) {
            $local = $searcher->find($string, false, 16);
            if ($local) {
                foreach ($local as $result) {
                    $ret[] = [
                        'id'          => $result->getId(),
                        'type'        => $result->getType(),
                        'title'       => check_plain($result->getTitle()),
                        'group'       => check_plain($result->getGroup()),
                        'description' => check_plain($result->getDescription()),
                    ];
                }
            }
        }

        return new JsonResponse($ret);
    }
403264
public function select( $request, $query_params = [] )
	{
		if( is_array($request) )
		{
			$template = reset($request);
			$query_params = end($request);
		}
		else if( is_string($request) )
		{
			$template = $request;
		}

		$statement = $this->_query_( $template, $query_params );

		$results = [];
		try {
			$results = $statement->fetchAll( \PDO::FETCH_ASSOC );
		} catch (PDOException $e) {
			if( DB_DEBUG_QUERY )
			{
				debug($e->getMessage());
			} 
			else
			{
				debug('Query Error');
			}
			exit;
		}

		return $results;
	}
366122
public function expandQuery(QueryInterface $searchQuery, array $requestParameters = []): QueryInterface
    {
        $this->setMaxSizeToQuery($searchQuery->getSearchQuery(), 10000);

        return $searchQuery;
    }
342923
public function buildSearchQuery($rawQuery, $resultsPerPage = 10, array $additionalFiltersFromRequest = []) : SearchQuery
    {
        if ($this->typoScriptConfiguration->getLoggingQuerySearchWords()) {
            $this->logger->log(SolrLogManager::INFO, 'Received search query', [$rawQuery]);
        }

        /* @var $query SearchQuery */
        return $this->newSearchQuery($rawQuery)
                ->useResultsPerPage($resultsPerPage)
                ->useReturnFieldsFromTypoScript()
                ->useQueryFieldsFromTypoScript()
                ->useInitialQueryFromTypoScript()
                ->useFiltersFromTypoScript()
                ->useFilterArray($additionalFiltersFromRequest)
                ->useFacetingFromTypoScript()
                ->useVariantsFromTypoScript()
                ->useGroupingFromTypoScript()
                ->useHighlightingFromTypoScript()
                ->usePhraseFieldsFromTypoScript()
                ->useBigramPhraseFieldsFromTypoScript()
                ->useTrigramPhraseFieldsFromTypoScript()
                ->useOmitHeader(false)
                ->getQuery();
    }
1328390
protected function forSearchEventsRequest(SearchEventsRequest $request, ParsedQuery $parsedQuery): Query
    {
        $builder = new ElasticaQueryBuilder();
        $builder->setDefaultFieldName('_all')->addParsedQuery($parsedQuery);
        $query = $builder->getBoolQuery();
        return Query::create($this->createSortedQuery($query, $request));
    }
166947
public function getQueryBuilder(ColumnCollection $columns, DataSetRequestInterface $request): QueryBuilder
    {
        $this->conditions = $this->getConditions($request);
        
        $this->queryBuilder->select($columns->getSelectClause());
        $this->queryBuilder->addOrderBy($this->getOrderByExpression($request, $columns));
        $this->queryBuilder->setFirstResult($request->getOffset());
        $this->setColumnConditions($columns);
        
        if ($request->getLimit() > 0) {
            $this->queryBuilder->setMaxResults($request->getLimit());
        }
        
        return $this->queryBuilder;
    }
591398
protected function getExcludeFiltersComponent(SearchQuery $searchQuery)
    {
        $fq = array();
        foreach ($searchQuery->exclude as $field => $values) {
            // Handle namespaced class names
            $field = $this->sanitiseClassName($field);

            $excludeq = [];
            $missing = false;

            foreach ($values as $value) {
                if ($value === SearchQuery::$missing) {
                    $missing = true;
                } elseif ($value === SearchQuery::$present) {
                    $excludeq[] = "{$field}:[* TO *]";
                } elseif ($value instanceof SearchQuery_Range) {
                    $start = $value->start;
                    if ($start === null) {
                        $start = '*';
                    }
                    $end = $value->end;
                    if ($end === null) {
                        $end = '*';
                    }
                    $excludeq[] = "$field:[$start TO $end]";
                } else {
                    $excludeq[] = $field . ':"' . $value . '"';
                }
            }

            $fq[] = ($missing ? "+{$field}:[* TO *] " : '') . '-(' . implode(' ', $excludeq) . ')';
        }
        return $fq;
    }
1220864
public function getQueryBuilderFromRequest(Request $request)
    {
        $qb = $this->createValuedQueryBuilder('c');

        if ($request->get('q')) {
            $qb->leftJoin('c.template', 't');
            $qb->andWhere('c.title LIKE :query OR c.alias LIKE :query OR c.slug LIKE :query OR t.displayName LIKE :query')->setParameter('query', '%' . $request->get('q') . '%');
        } else {
            //if ($request->get('directory_id')) {
            //    $qb->andWhere('c.directory = :directory')->setParameter('directory', $request->get('directory_id'));
            //} else {
            //    $qb->andWhere('c.directory is NULL');
            //}
        }

        if ($ids = $request->get('ids')) {
            $ids = explode(',', $ids);

            $qb->andWhere('c.id IN (:ids)')->setParameter('ids', $ids);
        }

        $qb->andWhere('c.deletedAt IS NULL');  // @TODO fix SoftDeleteAble filter

        $qb->orderBy('c.slug');

        return $qb;
    }
744319
public static function dataTableFiltering($request, $parameters)
    {
        $args['where'] = null;
        if($request->input('search')['value'] !== "")
        {
            $parameters['where'] = $request->input('search')['value'];
        }
        return $parameters;
    }
360625
protected function getAvailableOptions($scope, $searchQuery = null)
    {
        if ($scope->options) {
            return $this->getOptionsFromArray($scope, $searchQuery);
        }

        $available = [];
        $nameColumn = $this->getScopeNameFrom($scope);
        $options = $this->getOptionsFromModel($scope, $searchQuery);
        foreach ($options as $option) {
            $available[$option->getKey()] = $option->{$nameColumn};
        }

        return $available;
    }
496776
protected function prepareSearch(array $unparsed, bool $isSearch = false, $hasSubquery = false): array
    {
        $statement = [
            'conditions' => "1 = 1",
            'bind' => [],
        ];

        if ($isSearch) {
            $mapped = $this->parseSearchParameters($unparsed['params']);
            $conditions = '1 = 1';

            $tmpMapped = $mapped;

            foreach ($tmpMapped as $key => $value) {
                if (strpos($value, '~') !== false) {
                    unset($tmpMapped[$key]);
                    $betweenMap[$key] = explode('~', $value);
                }
            }

            $keys = array_keys($tmpMapped);
            $values = array_values($tmpMapped);

            $di = Di::getDefault();

            foreach ($keys as $key => $field) {
                if ($di->get('config')->database->adapter == 'Postgresql') {
	       	           $conditions .= " AND CAST({$field} AS TEXT) LIKE ?{$key}";
    	    	}
    	        else {
    	    	    $conditions .= " AND {$field} LIKE ?{$key}";
    	    	}
            }

            if (isset($betweenMap)) {
                foreach ($betweenMap as $key => $fields) {
                    $binds = count($values);
                    $conditions .= ' AND ' . $key . ' BETWEEN ?' . $binds . ' AND ?' . ($binds + 1);
                    $values = array_merge($values, $fields);
                }
            }

            if ($hasSubquery) {
                $subquery = $this->parseSubquery($unparsed['subquery']);
                $conditions .= ' AND ' . $subquery['firstField'] . ' ' . $subquery['action'] . ' (select ' . $subquery['secondField'] . ' FROM ' . $subquery['model'] . ')';
            }

            $statement = [
                'conditions' => $conditions,
                'bind' => $values,
            ];
        }

        return $statement;
    }