Content/ArticleDataProvider.php
private function getSearchResult(array $filters, $limit, $page, $pageSize, $locale, $webspaceKey)
    {
        $repository = $this->searchManager->getRepository($this->articleDocumentClass);
        $search = $this->createSearch($repository->createSearch(), $filters, $locale);
        if (!$search) {
            return new \ArrayIterator([]);
        }

        $this->addPagination($search, $pageSize, $page, $limit);

        if (array_key_exists('sortBy', $filters) && is_array($filters['sortBy'])) {
            $sortMethod = array_key_exists('sortMethod', $filters) ? $filters['sortMethod'] : 'asc';
            $this->appendSortBy($filters['sortBy'], $sortMethod, $search);
        }

        if ($webspaceKey) {
            $webspaceQuery = new BoolQuery();

            // check for mainWebspace
            $webspaceQuery->add(new TermQuery('main_webspace', $webspaceKey), BoolQuery::SHOULD);

            // check for additionalWebspaces
            $webspaceQuery->add(new TermQuery('additional_webspaces', $webspaceKey), BoolQuery::SHOULD);

            $search->addQuery($webspaceQuery);
        }

        return $repository->findDocuments($search);
    }
private function getSearchResult(array $filters, $limit, $page, $pageSize, $locale, $webspaceKey)
    {
        $repository = $this->searchManager->getRepository($this->articleDocumentClass);
        $search = $this->createSearch($repository->createSearch(), $filters, $locale);
        if (!$search) {
            return new \ArrayIterator([]);
        }

        $this->addPagination($search, $pageSize, $page, $limit);

        if (array_key_exists('sortBy', $filters) && is_array($filters['sortBy'])) {
            $sortMethod = array_key_exists('sortMethod', $filters) ? $filters['sortMethod'] : 'asc';
            $this->appendSortBy($filters['sortBy'], $sortMethod, $search);
        }

        if ($webspaceKey) {
            $webspaceQuery = new BoolQuery();

            // check for mainWebspace
            $webspaceQuery->add(new TermQuery('main_webspace', $webspaceKey), BoolQuery::SHOULD);

            // check for additionalWebspaces
            $webspaceQuery->add(new TermQuery('additional_webspaces', $webspaceKey), BoolQuery::SHOULD);

            $search->addQuery($webspaceQuery);
        }

        return $repository->findDocuments($search);
    }
private function getSearchResult ( array $ filters , $ limit , $ page , $ pageSize , $ locale , $ webspaceKey ) { $ repository = $ this -> searchManager -> getRepository ( $ this -> articleDocumentClass ) ; $ search = $ this -> createSearch ( $ repository -> createSearch ( ) , $ filters , $ locale ) ; if ( ! $ search ) { return new \ ArrayIterator ( [ ] ) ; } $ this -> addPagination ( $ search , $ pageSize , $ page , $ limit ) ; if ( array_key_exists ( 'sortBy' , $ filters ) && is_array ( $ filters [ 'sortBy' ] ) ) { $ sortMethod = array_key_exists ( 'sortMethod' , $ filters ) ? $ filters [ 'sortMethod' ] : 'asc' ; $ this -> appendSortBy ( $ filters [ 'sortBy' ] , $ sortMethod , $ search ) ; } if ( $ webspaceKey ) { $ webspaceQuery = new BoolQuery ( ) ; // check for mainWebspace $ webspaceQuery -> add ( new TermQuery ( 'main_webspace' , $ webspaceKey ) , BoolQuery :: SHOULD ) ; // check for additionalWebspaces $ webspaceQuery -> add ( new TermQuery ( 'additional_webspaces' , $ webspaceKey ) , BoolQuery :: SHOULD ) ; $ search -> addQuery ( $ webspaceQuery ) ; } return $ repository -> findDocuments ( $ search ) ; }
Creates search for filters and returns search-result.

@param array $filters
@param int $limit
@param int $page
@param int $pageSize
@param string $locale
@param null|string $webspaceKey

@return \Countable
Creates search for filters and returns search - result .