<commit_before><?php

namespace Sajari\Search;

require_once __DIR__.'/../proto/engine/query/v1/query.php';

use sajari\engine\query\v1\Aggregate\Count as EngineCount;
use sajari\engine\query\v1\Aggregate as EngineAggregate;
use sajari\engine\query\v1\Request\AggregatesEntry as EngineAggregatesEntry;

class CountAggregate extends Aggregate
{
    /** @var string $field */
    private $field;
    /** @var string $name */
    private $name;

    /**
     * CountAggregate constructor.
     * @param string $field
     * @param $name
     */
    public function __construct($field, $name)
    {
        $this->field = $field;
        $this->name = $name;
    }

    /**
     * @return mixed
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @return string
     */
    public function getField()
    {
        return $this->field;
    }

    public function Proto()
    {
        $ca = new EngineCount();
        $ca->setField($this->field);

        $a = new EngineAggregate();
        $a->setCount($ca);

        $ae = new EngineAggregatesEntry();
        $ae->setKey($this->name);
        $ae->setValue($a);
        return $ae;
    }
}
<commit_msg>Fix import in CountAggregate<commit_after><?php

namespace Sajari\Search;

require_once __DIR__.'/../proto/engine/query/v1/query.php';

use sajari\engine\query\v1\Aggregate\Count as EngineCount;
use sajari\engine\query\v1\Aggregate as EngineAggregate;
use sajari\engine\query\v1\SearchRequest\AggregatesEntry as EngineAggregatesEntry;

class CountAggregate extends Aggregate
{
    /** @var string $field */
    private $field;
    /** @var string $name */
    private $name;

    /**
     * CountAggregate constructor.
     * @param string $field
     * @param $name
     */
    public function __construct($field, $name)
    {
        $this->field = $field;
        $this->name = $name;
    }

    /**
     * @return mixed
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @return string
     */
    public function getField()
    {
        return $this->field;
    }

    public function Proto()
    {
        $ca = new EngineCount();
        $ca->setField($this->field);

        $a = new EngineAggregate();
        $a->setCount($ca);

        $ae = new EngineAggregatesEntry();
        $ae->setKey($this->name);
        $ae->setValue($a);
        return $ae;
    }
}

{'fraction_non_alphanumeric': 0.1427978414279784, 'fraction_numerical': 0.0033208800332088003, 'mean_word_length': 2.187830687830688, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7232172', 'n_tokens_mistral': 775, 'n_tokens_neox': 785, 'n_words': 159}