Search guide
Create index type
php
class TextIndexType extends AbstractIndexType implements IndexTypeInterface
{
public function buildIndex(array $options, $model, IndexDataBuilder $builder): void
{
$text = $model->getText();
$index = new IndexData($text, 20);
$builder->addIndex($index);
}
}
Create filter type
php
class PublicFilterType extends AbstractIndexType implements IndexTypeInterface
{
public function buildFilter(array $options, $model, string $key, FilterDataBuilder $builder): void
{
$public = $model->getPublic();
$data = new FilterData($key, $public);
$builder->addData($data);
}
public function buildField(array $options, string $key, FilterDataBuilder $builder): void
{
$builder->addField(new FilterField($key, FilterField::FIELD_TYPE_BOOLEAN));
}
}