$fields
*/
public function __construct(
private array $fields,
private bool|int|string|null $query,
private float $boost = 1.0,
private \Spameri\ElasticQuery\Query\Match\Fuzziness|null $fuzziness = null,
private string $type = \Spameri\ElasticQuery\Query\Match\MultiMatchType::BEST_FIELDS,
private int|string|null $minimumShouldMatch = null,
private string $operator = \Spameri\ElasticQuery\Query\Match\Operator::OR,
private string|null $analyzer = null,
private float|null $tieBreaker = null,
private int|null $slop = null,
private int|null $prefixLength = null,
private int|null $maxExpansions = null,
private bool|null $lenient = null,
private string|null $zeroTermsQuery = null,
private bool|null $autoGenerateSynonymsPhraseQuery = null,
private bool|null $fuzzyTranspositions = null,
private string|null $fuzzyRewrite = null,
)
{
if ( ! \in_array($operator, \Spameri\ElasticQuery\Query\Match\Operator::OPERATORS, true)) {
throw new \Spameri\ElasticQuery\Exception\InvalidArgumentException(
'Parameter $operator is invalid, see \Spameri\ElasticQuery\Query\Match\Operator::OPERATORS for valid arguments.',
);
}
if ( ! \in_array($type, \Spameri\ElasticQuery\Query\Match\MultiMatchType::TYPES, true)) {
throw new \Spameri\ElasticQuery\Exception\InvalidArgumentException(
'Parameter $type is invalid, see \Spameri\ElasticQuery\Query\Match\MultiMatchType::TYPES for valid arguments.',
);
}
}
public function changeAnalyzer(string $newAnalyzer): void
{
$this->analyzer = $newAnalyzer;
}
public function key(): string
{
return 'multiMatch_' . \implode('-', $this->fields) . '_' . (string) $this->query;
}
/**
* @return array