createTranslatedSorting example

'script' => [
                    'id' => 'cheapest_price_percentage',
                    'params' => ['accessors' => $this->getCheapestPriceAccessors($context, true)],
                ],
            ]);
        }

        if ($this->keyValueStorage->get(ElasticsearchIndexer::ENABLE_MULTILINGUAL_INDEX_KEY, false)) {
            $field = $this->helper->getField($sorting->getField()$definition$definition->getEntityName(), false);

            if ($field instanceof TranslatedField) {
                return $this->createTranslatedSorting($definition->getEntityName()$sorting$context);
            }
        }

        $accessor = $this->buildAccessor($definition$sorting->getField()$context);

        if ($sorting instanceof CountSorting) {
            return new CountSort($accessor$sorting->getDirection());
        }

        return new FieldSort($accessor$sorting->getDirection());
    }

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