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    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     * @param string $field
23     * @param int    $maxExpansions
24     *
25     * @return $this
26     */
27    public function setFieldMaxExpansions(string $field, int $maxExpansions = self::DEFAULT_MAX_EXPANSIONS): self
28    {
29        return $this->setFieldParam($field, 'max_expansions', $maxExpansions);
30    }
31}
32