Newer
Older
<?php
/*
* This file is part of the ONGR package.
*
* (c) NFQ Technologies UAB <info@nfq.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ONGR\ElasticsearchDSL\Suggest;
use ONGR\ElasticsearchDSL\NamedBuilderInterface;
class Suggest implements NamedBuilderInterface
private string $name;
private string $type;
private string $text;
private string $field;
public function __construct(string $name, string $type, string $text, string $field, array $parameters = [])
{
$this->setName($name);
$this->setType($type);
$this->setText($text);
/**
* {@inheritdoc}
*/
public function toArray(): array|\stdClass
return [
$this->getName() => [
'text' => $this->getText(),
$this->getType() => $this->processArray(['field' => $this->getField()]),
],
];
{
return $this->name;
}
public function getType(): string
{
return $this->type;
}
public function setType(string $type): static
{
$this->type = $type;
return $this;
}