DisMaxQuery example


        $fieldName = $this->buildAccessor($definition$filter->getField()$context);

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

            $value = $this->parseValue($definition$filter, \array_values($filter->getValue()));

            $query = new TermsQuery($fieldName$value);

            if ($field instanceof TranslatedField) {
                $query = new DisMaxQuery();
                foreach ($context->getLanguageIdChain() as $languageId) {
                    $accessor = $this->getTranslatedFieldName($fieldName$languageId);
                    $query->addQuery(new TermsQuery($accessor$value));
                }
            }

            return $this->createNestedQuery(
                $query,
                $definition,
                $filter->getField()
            );
        }
Home | Imprint | This part of the site doesn't use cookies.