for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the ONGR package.
*
* (c) NFQ Technologies UAB <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ONGR\FilterManagerBundle\Filters\Widget\Search;
use ONGR\ElasticsearchDSL\Filter\TermFilter;
use ONGR\ElasticsearchDSL\Query\MatchQuery;
use ONGR\ElasticsearchDSL\Search;
use ONGR\FilterManagerBundle\Filters\FilterState;
use ONGR\FilterManagerBundle\Filters\Relations\RelationsAwareInterface;
use ONGR\FilterManagerBundle\Filters\Relations\RelationsAwareTrait;
use ONGR\FilterManagerBundle\Search\SearchRequest;
use Symfony\Component\HttpFoundation\Request;
/**
* Filter for filtering on exact value in specified field.
class FieldValue extends AbstractSingleValue implements RelationsAwareInterface
{
use RelationsAwareTrait;
* @var string
protected $value;
* Setter for field value.
* @param $value
* @return $this
public function setValue($value)
$this->value = $value;
return $this;
}
* {@inheritdoc}
public function getState(Request $request)
$state = new FilterState();
$state->setActive(true);
return $state;
public function modifySearch(Search $search, FilterState $state = null, SearchRequest $request = null)
$search->addPostFilter(new TermFilter($this->getField(), $this->value));