Completed
Push — master ( 7d3672...a34d6f )
by Simonas
357:48 queued 292:56
created

VariantFilter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 11
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A modifySearch() 0 5 1
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\FilterManagerBundle\Filter\Widget\Search;
13
14
use ONGR\ElasticsearchDSL\Filter\BoolFilter;
15
use ONGR\ElasticsearchDSL\Filter\MissingFilter;
16
use ONGR\ElasticsearchDSL\Search;
17
use ONGR\FilterManagerBundle\Filter\FilterState;
18
use ONGR\FilterManagerBundle\Search\SearchRequest;
19
20
/**
21
 * This filter selects only parent documents.
22
 */
23
class VariantFilter extends AbstractSingleValue
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function modifySearch(Search $search, FilterState $state = null, SearchRequest $request = null)
29
    {
30
        $filter = new MissingFilter($this->getField());
31
        $search->addFilter($filter, BoolFilter::MUST);
32
    }
33
}
34