Commit 7c725de6 authored by Nikita Chernykh's avatar Nikita Chernykh
Browse files

temporary commit without aggregations

parent bac145ea
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -3,17 +3,23 @@
namespace IQDEV\ElasticSearch\Config;

use IQDEV\ElasticSearch\Configuration;
use IQDEV\ElasticSearch\Mapping;

class BaseConfiguration implements Configuration
{
    public function __construct(
        private readonly Mapping $mapping,
    ) {
    }

    public function getIndexName(): string
    {
        return $_ENV['IQ_ES_PRODUCT_SEARCH_INDEX'];
    }

    public function getMapping(): array
    public function getMapping(): Mapping
    {
        return include __DIR__.'/product.mappings.php';
        return $this->mapping;
    }

    public function getSettings(): array
+41 −0
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

namespace IQDEV\ElasticSearch\Config\Mapping;

use IQDEV\ElasticSearch\Mapping;

class ProductMapping extends Mapping
{

    public function getPropertiesMap(): array
    {
        return [
            'data' => [
                'type' => 'object',
                'enabled' => false,
            ],
            'full_search_content' => [
                'type' => 'text',
            ],
            'suggest_search_content' => [
                'type' => 'text',
                'analyzer' => 'autocomplete',
                'search_analyzer' => 'standard',
            ],
            'category_id' => [
                'type' => 'keyword',
                'index' => false,
            ],
            'rating' => [
                'type' => 'double',
                'index' => false,
            ],
            'popular' => [
                'type' => 'double',
                'index' => false,
            ],
        ];
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ class MappingValidator
     */
    public static function isPropertyExists(Configuration $configuration, string $property): bool
    {
        $properties = array_keys($configuration->getMapping()['properties'] ?? []);
        $properties = array_keys($configuration->getMapping()->es()['properties'] ?? []);

        return in_array($property, $properties, true);
    }
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ interface Configuration
{
    public function getIndexName(): string;

    public function getMapping(): array;
    public function getMapping(): Mapping;

    public function getSettings(): array;
}
+228 −178

File changed.

Preview size limit exceeded, changes collapsed.

Loading