enabledMultilingualIndex example

$search,
                $definition,
                $criteria,
                $context
            )
        );

        $search = $this->convertSearch($criteria$definition$context$search);

        try {
            $result = $this->client->search([
                'index' => $this->helper->getIndexName($definition$this->helper->enabledMultilingualIndex() ? null : $context->getLanguageId()),
                'track_total_hits' => true,
                'body' => $search,
            ]);
        } catch (\Throwable $e) {
            $this->helper->logAndThrowException($e);

            return $this->decorated->search($definition$criteria$context);
        }

        $result = $this->hydrator->hydrate($definition$criteria$context$result);

        
$search = $this->createSearch($definition$criteria$context);

        $this->eventDispatcher->dispatch(
            new ElasticsearchEntityAggregatorSearchEvent($search$definition$criteria$context)
        );

        $searchArray = $search->toArray();
        $searchArray['timeout'] = $this->timeout;

        try {
            $result = $this->client->search([
                'index' => $this->helper->getIndexName($definition$this->helper->enabledMultilingualIndex() ? null : $context->getLanguageId()),
                'body' => $searchArray,
            ]);
        } catch (\Throwable $e) {
            $this->helper->logAndThrowException($e);

            return $this->decorated->aggregate($definition$criteria$context);
        }

        $result = $this->hydrator->hydrate($definition$criteria$context$result);
        $result->addState(self::RESULT_STATE);

        
$searchConfig = $this->fetchConfig($context);

        $isAndSearch = $searchConfig[0]['and_logic'] === '1';

        $tokens = $this->tokenizer->tokenize((string) $criteria->getTerm());
        $tokens = $this->tokenFilter->filter($tokens$context);

        foreach ($tokens as $token) {
            $tokenBool = new BoolQuery();

            foreach ($searchConfig as $item) {
                if ($this->elasticsearchHelper->enabledMultilingualIndex()) {
                    $config = new SearchFieldConfig((string) $item['field'](int) $item['ranking'](bool) $item['tokenize']);
                    $field = $this->helper->getField($config->getField()$this->productDefinition, $this->productDefinition->getEntityName(), false);
                    $association = $this->helper->getAssociationPath($config->getField()$this->productDefinition);
                    $root = $association ? explode('.', $association)[0] : null;

                    if ($field instanceof TranslatedField) {
                        $this->buildTranslatedFieldTokenQueries($tokenBool$token$config$context$root);

                        continue;
                    }

                    

        };
    }

    /** * @param array<string, array<mixed>> $newCreatedFields */
    private function createNewFieldsInIndices(array $newCreatedFields): void
    {
        $indices = $this->indexDetector->getAllUsedIndices();

        $enabledMultilingualIndex = $this->elasticsearchHelper->enabledMultilingualIndex();
        $languageIds = $enabledMultilingualIndex ? $this->connection->fetchFirstColumn('SELECT LOWER(HEX(`id`)) FROM language') : [];

        foreach ($indices as $indexName) {
            // Check if index is old language based index             $isLanguageBasedIndex = true;

            $body = [
                'properties' => [
                    'customFields' => [
                        'properties' => [],
                    ],
                ],
$offset->resetDefinitions();
        $offset->setLastId(null);

        return $this->iterate($offset);
    }

    /** * @param array<string> $ids */
    public function updateIds(EntityDefinition $definition, array $ids): void
    {
        if ($this->helper->enabledMultilingualIndex()) {
            $this->newImplementation->updateIds($definition$ids);

            return;
        }

        if (!$this->helper->allowIndexing()) {
            return;
        }

        $alias = $this->helper->getIndexName($definition, Defaults::LANGUAGE_SYSTEM);

        


    /** * @return array<string> */
    private function getPrefixes(): array
    {
        $definitions = $this->registry->getDefinitions();

        $prefixes = [];

        if ($this->helper->enabledMultilingualIndex()) {
            foreach ($definitions as $definition) {
                $prefixes[] = sprintf('%s_*', $this->helper->getIndexName($definition->getEntityDefinition()));
            }

            return $prefixes;
        }

        $languages = $this->languageProvider->getLanguages(Context::createDefaultContext());

        foreach ($languages as $language) {
            foreach ($definitions as $definition) {
                
true,
            true,
            'prefix',
            true,
            $this->createMock(Client::class),
            $registry,
            $this->createMock(CriteriaParser::class),
            $this->createMock(LoggerInterface::class),
            $storage
        );

        static::assertEquals($expected$helper->enabledMultilingualIndex());
    }

    /** * @return iterable<string, array<string, mixed>> */
    public static function enableMultilingualIndexCases(): iterable
    {
        yield 'with flag not set' => [
            'flag' => null,
            'expected' => false,
        ];

        
Home | Imprint | This part of the site doesn't use cookies.