Skip to content

Commit

Permalink
Fix wrong properties / class names in Elasticsearch extension documen…
Browse files Browse the repository at this point in the history
…tation (#1460)
  • Loading branch information
nickygerritsen authored Aug 23, 2024
1 parent cac9e9d commit dbba03f
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ namespace Swag\BasicExample\Elasticsearch\Product;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
use Shopware\Elasticsearch\Framework\AbstractElasticsearchDefinition;
use Shopware\Elasticsearch\Framework\Indexing\EntityMapper;
use Doctrine\DBAL\Connection;
use Swag\BasicExample\Subscriber\ProductSubscriber;

Expand All @@ -231,7 +230,7 @@ class MyProductEsDecorator extends AbstractElasticsearchDefinition

public function buildTermQuery(Context $context, Criteria $criteria): BoolQuery
{
return $this->decoratedService->buildTermQuery($context, $criteria);
return $this->productDefinition->buildTermQuery($context, $criteria);
}

/**
Expand All @@ -243,21 +242,21 @@ class MyProductEsDecorator extends AbstractElasticsearchDefinition
$mapping = $this->productDefinition->getMapping($context);

//The mapping for a simple keyword field
$mapping['properties']['customString'] = EntityMapper::KEYWORD_FIELD;
$mapping['properties']['customString'] = AbstractElasticsearchDefinition::KEYWORD_FIELD;

// Adding an association as keyword
$mapping['properties']['oneToOneExampleExtension'] = [
'type' => 'nested',
'properties' => [
'customString' => EntityMapper::KEYWORD_FIELD,
'customString' => AbstractElasticsearchDefinition::KEYWORD_FIELD,
],
];

// Adding a nested field with id
$mapping['properties']['oneToManyExampleExtension'] = [
'type' => 'nested',
'properties' => [
'id' => EntityMapper::KEYWORD_FIELD,
'id' => AbstractElasticsearchDefinition::KEYWORD_FIELD,
],
];

Expand Down

0 comments on commit dbba03f

Please sign in to comment.