1<?php
2
3namespace Elastica\Query;
4
5/**
6 * Match Phrase Prefix query.
7 *
8 * @author Jacques Moati <jacques@moati.net>
9 * @author Tobias Schultze <http://tobion.de>
10 *
11 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase-prefix.html
12 */
13class MatchPhrasePrefix extends MatchPhrase
14{
15    public const DEFAULT_MAX_EXPANSIONS = 50;
16
17    /**
18     * Set field max expansions.
19     *
20     * Controls to how many prefixes the last term will be expanded (default 50).
21     *
22     * @return $this
23     */
24    public function setFieldMaxExpansions(string $field, int $maxExpansions = self::DEFAULT_MAX_EXPANSIONS): self
25    {
26        return $this->setFieldParam($field, 'max_expansions', $maxExpansions);
27    }
28}
29