Content/ArticleDataProvider.php
protected function createSearch(Search $search, array $filters, $locale)
    {
        if (0 < count($filters['excluded'])) {
            foreach ($filters['excluded'] as $uuid) {
                $search->addQuery(new TermQuery('uuid', $uuid), BoolQuery::MUST_NOT);
            }
        }

        $query = new BoolQuery();

        $queriesCount = 0;
        $operator = $this->getFilter($filters, 'tagOperator', 'or');
        $this->addBoolQuery('tags', $filters, 'excerpt.tags.id', $operator, $query, $queriesCount);
        $operator = $this->getFilter($filters, 'websiteTagsOperator', 'or');
        $this->addBoolQuery('websiteTags', $filters, 'excerpt.tags.id', $operator, $query, $queriesCount);

        $operator = $this->getFilter($filters, 'categoryOperator', 'or');
        $this->addBoolQuery('categories', $filters, 'excerpt.categories.id', $operator, $query, $queriesCount);
        $operator = $this->getFilter($filters, 'websiteCategoriesOperator', 'or');
        $this->addBoolQuery('websiteCategories', $filters, 'excerpt.categories.id', $operator, $query, $queriesCount);

        if (null !== $locale) {
            $search->addQuery(new TermQuery('locale', $locale));
        }

        if (array_key_exists('types', $filters) && $filters['types']) {
            $typesQuery = new BoolQuery();
            foreach ($filters['types'] as $typeFilter) {
                $typesQuery->add(new TermQuery('type', $typeFilter), BoolQuery::SHOULD);
            }
            $search->addQuery($typesQuery);
        }

        if (array_key_exists('structureTypes', $filters) && $filters['structureTypes']) {
            $strTypesQuery = new BoolQuery();
            foreach ($filters['structureTypes'] as $filter) {
                $strTypesQuery->add(new TermQuery('structure_type', $filter), BoolQuery::SHOULD);
            }
            $search->addQuery($strTypesQuery);
        }

        if (0 === $queriesCount) {
            $search->addQuery(new MatchAllQuery(), BoolQuery::MUST);
        } else {
            $search->addQuery($query, BoolQuery::MUST);
        }

        return $search;
    }
protected function createSearch(Search $search, array $filters, $locale)
    {
        if (0 < count($filters['excluded'])) {
            foreach ($filters['excluded'] as $uuid) {
                $search->addQuery(new TermQuery('uuid', $uuid), BoolQuery::MUST_NOT);
            }
        }

        $query = new BoolQuery();

        $queriesCount = 0;
        $operator = $this->getFilter($filters, 'tagOperator', 'or');
        $this->addBoolQuery('tags', $filters, 'excerpt.tags.id', $operator, $query, $queriesCount);
        $operator = $this->getFilter($filters, 'websiteTagsOperator', 'or');
        $this->addBoolQuery('websiteTags', $filters, 'excerpt.tags.id', $operator, $query, $queriesCount);

        $operator = $this->getFilter($filters, 'categoryOperator', 'or');
        $this->addBoolQuery('categories', $filters, 'excerpt.categories.id', $operator, $query, $queriesCount);
        $operator = $this->getFilter($filters, 'websiteCategoriesOperator', 'or');
        $this->addBoolQuery('websiteCategories', $filters, 'excerpt.categories.id', $operator, $query, $queriesCount);

        if (null !== $locale) {
            $search->addQuery(new TermQuery('locale', $locale));
        }

        if (array_key_exists('types', $filters) && $filters['types']) {
            $typesQuery = new BoolQuery();
            foreach ($filters['types'] as $typeFilter) {
                $typesQuery->add(new TermQuery('type', $typeFilter), BoolQuery::SHOULD);
            }
            $search->addQuery($typesQuery);
        }

        if (array_key_exists('structureTypes', $filters) && $filters['structureTypes']) {
            $strTypesQuery = new BoolQuery();
            foreach ($filters['structureTypes'] as $filter) {
                $strTypesQuery->add(new TermQuery('structure_type', $filter), BoolQuery::SHOULD);
            }
            $search->addQuery($strTypesQuery);
        }

        if (0 === $queriesCount) {
            $search->addQuery(new MatchAllQuery(), BoolQuery::MUST);
        } else {
            $search->addQuery($query, BoolQuery::MUST);
        }

        return $search;
    }
protected function createSearch ( Search $ search , array $ filters , $ locale ) { if ( 0 < count ( $ filters [ 'excluded' ] ) ) { foreach ( $ filters [ 'excluded' ] as $ uuid ) { $ search -> addQuery ( new TermQuery ( 'uuid' , $ uuid ) , BoolQuery :: MUST_NOT ) ; } } $ query = new BoolQuery ( ) ; $ queriesCount = 0 ; $ operator = $ this -> getFilter ( $ filters , 'tagOperator' , 'or' ) ; $ this -> addBoolQuery ( 'tags' , $ filters , 'excerpt.tags.id' , $ operator , $ query , $ queriesCount ) ; $ operator = $ this -> getFilter ( $ filters , 'websiteTagsOperator' , 'or' ) ; $ this -> addBoolQuery ( 'websiteTags' , $ filters , 'excerpt.tags.id' , $ operator , $ query , $ queriesCount ) ; $ operator = $ this -> getFilter ( $ filters , 'categoryOperator' , 'or' ) ; $ this -> addBoolQuery ( 'categories' , $ filters , 'excerpt.categories.id' , $ operator , $ query , $ queriesCount ) ; $ operator = $ this -> getFilter ( $ filters , 'websiteCategoriesOperator' , 'or' ) ; $ this -> addBoolQuery ( 'websiteCategories' , $ filters , 'excerpt.categories.id' , $ operator , $ query , $ queriesCount ) ; if ( null !== $ locale ) { $ search -> addQuery ( new TermQuery ( 'locale' , $ locale ) ) ; } if ( array_key_exists ( 'types' , $ filters ) && $ filters [ 'types' ] ) { $ typesQuery = new BoolQuery ( ) ; foreach ( $ filters [ 'types' ] as $ typeFilter ) { $ typesQuery -> add ( new TermQuery ( 'type' , $ typeFilter ) , BoolQuery :: SHOULD ) ; } $ search -> addQuery ( $ typesQuery ) ; } if ( array_key_exists ( 'structureTypes' , $ filters ) && $ filters [ 'structureTypes' ] ) { $ strTypesQuery = new BoolQuery ( ) ; foreach ( $ filters [ 'structureTypes' ] as $ filter ) { $ strTypesQuery -> add ( new TermQuery ( 'structure_type' , $ filter ) , BoolQuery :: SHOULD ) ; } $ search -> addQuery ( $ strTypesQuery ) ; } if ( 0 === $ queriesCount ) { $ search -> addQuery ( new MatchAllQuery ( ) , BoolQuery :: MUST ) ; } else { $ search -> addQuery ( $ query , BoolQuery :: MUST ) ; } return $ search ; }
Initialize search with neccesary queries.

@param Search $search
@param array $filters
@param string $locale

@return Search
Initialize search with neccesary queries .