1<?php
2
3namespace Elastica\Processor;
4
5/**
6 * Elastica Sort Processor.
7 *
8 * @author Federico Panini <fpanini@gmail.com>
9 *
10 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/sort-processor.html
11 */
12class SortProcessor extends AbstractProcessor
13{
14    use Traits\FieldTrait;
15    use Traits\IgnoreFailureTrait;
16
17    public const DEFAULT_ORDER_VALUE = 'asc';
18
19    public function __construct(string $field)
20    {
21        $this->setField($field);
22    }
23
24    /**
25     * Set order. Default 'asc'.
26     *
27     * @return $this
28     */
29    public function setOrder(string $order): self
30    {
31        return $this->setParam('order', $order);
32    }
33}
34