<commit_before><?php

namespace Elastica\Query;
use Elastica\Exception\NotImplementedException;
use Elastica\Filter\AbstractFilter;

/**
 * Filtered query. Needs a query and a filter
 *
 * @category Xodoa
 * @package Elastica
 * @author <NAME> <<EMAIL>>
 * @link http://www.elasticsearch.org/guide/reference/query-dsl/filtered-query.html
 */
class Filtered extends AbstractQuery
{
    /**
     * Query
     *
     * @var \Elastica\Query\AbstractQuery Query object
     */
    protected $_query = null;

    /**
     * Filter
     *
     * @var \Elastica\Filter\AbstractFilter Filter object
     */
    protected $_filter = null;

    /**
     * Constructs a filtered query
     *
     * @param \Elastica\Query\AbstractQuery   $query  Query object
     * @param \Elastica\Filter\AbstractFilter $filter Filter object
     */
    public function __construct(
        AbstractQuery $query = null,
        AbstractFilter $filter = null
    ) {
        $this->setQuery($query);
        $this->setFilter($filter);
    }

    /**<commit_msg>Condition was added to make not mandatory arguments<commit_after><?php

namespace Elastica\Query;
use Elastica\Exception\NotImplementedException;
use Elastica\Filter\AbstractFilter;

/**
 * Filtered query. Needs a query and a filter
 *
 * @category Xodoa
 * @package Elastica
 * @author <NAME> <<EMAIL>>
 * @link http://www.elasticsearch.org/guide/reference/query-dsl/filtered-query.html
 */
class Filtered extends AbstractQuery
{
    /**
     * Query
     *
     * @var \Elastica\Query\AbstractQuery Query object
     */
    protected $_query = null;

    /**
     * Filter
     *
     * @var \Elastica\Filter\AbstractFilter Filter object
     */
    protected $_filter = null;

    /**
     * Constructs a filtered query
     *
     * @param \Elastica\Query\AbstractQuery   $query  Query object
     * @param \Elastica\Filter\AbstractFilter $filter Filter object
     */
    public function __construct(
        AbstractQuery $query = null,
        AbstractFilter $filter = null
    ) {
        if ($query !== null) {
            $this->setQuery($query);
        }

        if ($filter !== null) {
            $this->setFilter($filter);
        }
    }

    /**
{'fraction_non_alphanumeric': 0.11930783242258652, 'fraction_numerical': 0.0, 'mean_word_length': 2.4381846635367763, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3928270', 'n_tokens_mistral': 653, 'n_tokens_neox': 645, 'n_words': 151}