@param ContentQueryParser $contentQuery

@return SearchQueryResultset
540269
public function postgresSearch(ContentQueryParser $contentQuery)
    {
        $set = new SearchQueryResultset();

        foreach ($contentQuery->getContentTypes() as $contentType) {
            $repo = $contentQuery->getEntityManager()->getRepository($contentType);
            $query = $repo->createQueryBuilder($contentType);
            $config = $contentQuery->getService('search_config');
            $search = $contentQuery->getParameter('filter');
            $adapter = new PostgresSearch($query, $config, explode(' ', $search));
            $adapter->setContentType($contentType);
            $result = $repo->findWith($adapter->getQuery());
            $set->add($result, $contentType);
        }

        return $set;
    }
1125167
public function getChangeLogEntryQuery($contentType, $contentId, $id, $cmpOp)
    {
        $alias = $this->getAlias();
        $contentTypeTableName = $this->em->getRepository($contentType)->getTableName();

        // Build base query
        $qb = $this->createQueryBuilder();
        $qb->select("$alias.*")
            ->leftJoin($alias, $contentTypeTableName, 'content', "content.id = $alias.contentid")
            ->where("$alias.id $cmpOp :logid")
            ->andWhere("$alias.contentid = :contentid")
            ->andWhere('contenttype = :contenttype')
            ->setParameters([
                ':logid'       => $id,
                ':contentid'   => $contentId,
                ':contenttype' => $contentType,
            ]);

        // Set ORDER BY
        if ($cmpOp === '<') {
            $qb->orderBy('date', 'DESC');
        } elseif ($cmpOp === '>') {
            $qb->orderBy('date');
        }

        return $qb;
    }
1234871
public function withContentType($contentType, $charset = null)
    {
        if (is_null($charset)) {
            return $this->withHeader('Content-Type', $contentType);
        }

        return $this->withHeader('Content-Type', $contentType . '; charset=' . $charset);
    }
582680
public function getContentFromContentElements($contentElements)
    {
        $content = '';

        // get content from content elements
        // NOTE: If the content elements contain links to files, those files will NOT be indexed.
        // NOTE: There's no restriction to certain content element types .
        // All attached content elements will be indexed. Only fields "header" and "bodytext" will be indexed.
        if (count($contentElements)) {
            /* @var $pageIndexerObject Page */
            $pageIndexerObject = GeneralUtility::makeInstance(Page::class, $this->pObj);

            foreach ($contentElements as $contentElement) {
                // index header, add header only if not set to "hidden"
                if ($contentElement['header_layout'] != 100) {
                    $content .= "\n" . strip_tags($contentElement['header']) . "\n";
                }

                // index bodytext (main content)
                $content .= "\n" . $pageIndexerObject->getContentFromContentElement($contentElement);
            }
        }

        return $content;
    }
571375
public function setContentLanguages($contentLanguages)
    {
        $fileVersion = $this->getFileVersion();

        foreach ($contentLanguages as $locale) {
            $contentLanguage = new FileVersionContentLanguage();
            $contentLanguage->setFileVersion($fileVersion);
            $contentLanguage->setLocale($locale);
            if (!$fileVersion->getContentLanguages()->contains($contentLanguage)) {
                $fileVersion->addContentLanguage($contentLanguage);
            }
        }

        return $this;
    }
159762
public function getRelation($contentType = null)
    {
        if (!$this->relation instanceof Collection\Relations) {
            $this->relation = new Collection\Relations();
        }

        if ($contentType !== null) {
            return $this->relation[$contentType];
        }

        return $this->relation;
    }
662319
public static function parse($strQuery, $encoding = null)
    {
        self::_getInstance();

        // Reset FSM if previous parse operation didn't return it into a correct state
        self::$_instance->reset();

        include_once 'Zend/Search/Lucene/Search/QueryParserException.php';
        try {
            include_once 'Zend/Search/Lucene/Search/QueryParserContext.php';

            self::$_instance->_encoding     = ($encoding !== null) ? $encoding : self::$_instance->_defaultEncoding;
            self::$_instance->_lastToken    = null;
            self::$_instance->_context      = new Zend_Search_Lucene_Search_QueryParserContext(self::$_instance->_encoding);
            self::$_instance->_contextStack = array();
            self::$_instance->_tokens       = self::$_instance->_lexer->tokenize($strQuery, self::$_instance->_encoding);

            // Empty query
            if (count(self::$_instance->_tokens) == 0) {
                include_once 'Zend/Search/Lucene/Search/Query/Insignificant.php';
                return new Zend_Search_Lucene_Search_Query_Insignificant();
            }


            foreach (self::$_instance->_tokens as $token) {
                try {
                    self::$_instance->_currentToken = $token;
                    self::$_instance->process($token->type);

                    self::$_instance->_lastToken = $token;
                } catch (Exception $e) {
                    if (strpos($e->getMessage(), 'There is no any rule for') !== false) {
                        throw new Zend_Search_Lucene_Search_QueryParserException('Syntax error at char position ' . $token->position . '.', 0, $e);
                    }

                    include_once 'Zend/Search/Lucene/Exception.php';
                    throw new Zend_Search_Lucene_Exception($e->getMessage(), $e->getCode(), $e);
                }
            }

            if (count(self::$_instance->_contextStack) != 0) {
                throw new Zend_Search_Lucene_Search_QueryParserException('Syntax Error: mismatched parentheses, every opening must have closing.');
            }

            return self::$_instance->_context->getQuery();
        } catch (Zend_Search_Lucene_Search_QueryParserException $e) {
            if (self::$_instance->_suppressQueryParsingExceptions) {
                $queryTokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($strQuery, self::$_instance->_encoding);

                include_once 'Zend/Search/Lucene/Search/Query/MultiTerm.php';
                $query = new Zend_Search_Lucene_Search_Query_MultiTerm();
                $termsSign = (self::$_instance->_defaultOperator == self::B_AND) ? true /* required term */ :
                                                                                   null /* optional term */;

                include_once 'Zend/Search/Lucene/Index/Term.php';
                foreach ($queryTokens as $token) {
                    $query->addTerm(new Zend_Search_Lucene_Index_Term($token->getTermText()), $termsSign);
                }


                return $query;
            } else {
                include_once 'Zend/Search/Lucene/Exception.php';
                throw new Zend_Search_Lucene_Exception($e->getMessage(), $e->getCode(), $e);
            }
        }
    }
839019
private function doGetCollectionByContent($contentType, $contentUid)
    {
        $content = null;
        $classname = AbstractClassContent::getClassnameByContentType($contentType);
        $em = $this->getApplication()->getEntityManager();

        try {
            $content = $em->find($classname, $contentUid);
        } catch (ClassNotFoundException $e) {
            throw new NotFoundHttpException("No classcontent found with provided type (:$contentType)");
        }

        if (null === $content) {
            throw new NotFoundHttpException("No `$classname` exists with uid `$contentUid`");
        }

        $pages = $em->getRepository("BackBee\ClassContent\AbstractClassContent")->findPagesByContent($content);

        $response = $this->createResponse($this->formatCollection($pages));
        if (0 < count($pages)) {
            $response->headers->set('Content-Range', '0-'.(count($pages) - 1).'/'.count($pages));
        }

        return $response;
    }
162922
protected function extractKeywordsFromContentType(ContentTypeInterface $contentType)
    {
        $keywordIds = array();
        $fields = $contentType->getFields();

        foreach ($fields as $field) {
            $fieldOptions = $field->getOptions();
            foreach ($fieldOptions as $option) {
                if ($this->isKeywordsConditionAttribute($option->getValue())) {
                    $keywordIds = array_merge(
                        $keywordIds,
                        $this->extractKeywordIdsFromConditionAttribute($option->getValue())
                    );
                }
            }
        }

        return $keywordIds;
    }
268608
private function getContentItems($contentTypeId, array $options)
    {
        $offset = $options['page'] * $options['pageSize'] - $options['pageSize'];
        $criteria = $this->generateCriteria($contentTypeId, $options);

        $query = new Query();
        $query->query = new Criterion\LogicalAnd($criteria);
        $query->limit = (int)$options['pageSize'];
        $query->offset = $offset;

        return $this->searchService->findContent(
            $query,
            (!empty($options['lang']) ? array('languages' => array($options['lang'])) : array())
        )->searchHits;
    }
11683
public function setContentHeader($contentType, $charset = 'UTF-8')
    {
        if (!$this->response) {
           return $this->getResponse()->setContentHeader($contentType, $charset);
        }
        return parent::setContentHeader($contentType, $charset);
    }
1108642
public CmsSolrResultList search(CmsObject cms, SolrQuery query) throws CmsSearchException {

        return search(cms, CmsEncoder.decode(query.toString()));
    }
879067
protected function getContent($textQuery, $parameters = [], &$pager = [], $whereParameters = [])
    {
        $isLegacy = $this->getOption('general/compatibility/setcontent_legacy', true);
        if ($isLegacy) {
            return $this->storage()->getContent($textQuery, $parameters, $pager, $whereParameters);
        }
        $params = array_merge($parameters, $whereParameters);
        unset($params['log_not_found']); // New storage system removes this functionality from the query engine

        return $this->app['query']->getContentForTwig($textQuery, $params);
    }
1247019
public function getContentKeyList(array $queryParams = [])
    {
        $propertyList = $this->_getEntityList('ContentKeys', $queryParams);
        $result = [];

        foreach ($propertyList as $properties) {
            $result[] = ContentKey::createFromOptions($properties);
        }

        return $result;
    }
594932
public function addParser(string $contentType, callable $parser): self
	{
		$this->parsers[$contentType] = \Closure::fromCallable($parser);

		return $this;
	}
988098
public function search(string $searchQuery): SectionTwigExtension
    {
        $this->options[ReadOptions::SEARCH] = $searchQuery;

        return $this;
    }
399643
public function process(SearchResultSet $resultSet)
    {
        $response = $resultSet->getResponse();
        if (!is_array($response->response->docs)) {
            return $resultSet;
        }

        if (!$this->typoScriptConfiguration->getSearchVariants()) {
            return $resultSet;
        }

        $variantsField = $this->typoScriptConfiguration->getSearchVariantsField();
        foreach ($resultSet->getSearchResults() as $key => $resultDocument) {
            /** @var $resultDocument SearchResult */
            $variantId = $resultDocument[$variantsField] ?? null;

            // when there is no value in the collapsing field, we can return
            if ($variantId === null) {
                continue;
            }

            $variantAccessKey = mb_strtolower($variantId);
            if (!isset($response->{'expanded'}) || !isset($response->{'expanded'}->{$variantAccessKey})) {
                continue;
            }

            $this->buildVariantDocumentAndAssignToParentResult($response, $variantAccessKey, $resultDocument);
        }

        return $resultSet;
    }