Completed
Pull Request — master (#1889)
by
unknown
02:43
created

DiversifiedSampler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setMaxDocsPerValue() 0 4 1
A setExecutionHint() 0 4 1
1
<?php
2
3
namespace Elastica\Aggregation;
4
5
/**
6
 * Class DiversifiedSampler.
7
 *
8
 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-diversified-sampler-aggregation.html
9
 */
10
class DiversifiedSampler extends AbstractSimpleAggregation
11
{
12
    use Traits\ShardSizeTrait;
13
14
    /**
15
     * Set the maximum number of documents to be returned per value.
16
     *
17
     * @return $this
18
     */
19
    public function setMaxDocsPerValue(int $max): self
20
    {
21
        return $this->setParam('max_docs_per_value', $max);
22
    }
23
24
    /**
25
     * Instruct Elasticsearch to use direct field data or ordinals/hashes of the field values to execute this aggregation.
26
     * The execution hint will be ignored if it is not applicable.
27
     *
28
     * @return $this
29
     */
30
    public function setExecutionHint(string $hint): self
31
    {
32
        return $this->setParam('execution_hint', $hint);
33
    }
34
}
35