Skip to content

Commit 301f1a5

Browse files
Merge pull request #329 from Flowpack/task/refactor-nodetype-name
!!! TASK: Do not convert the nodeType name
2 parents 085b709 + 359b459 commit 301f1a5

5 files changed

Lines changed: 4 additions & 33 deletions

File tree

Classes/Driver/AbstractNodeTypeMappingBuilder.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
declare(strict_types=1);
43

54
namespace Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver;
@@ -66,17 +65,6 @@ public function initializeObject($cause): void
6665
}
6766
}
6867

69-
/**
70-
* Converts a Content Repository Node Type name into a name which can be used for an Elasticsearch Mapping
71-
*
72-
* @param string $nodeTypeName
73-
* @return string
74-
*/
75-
public function convertNodeTypeNameToMappingName(string $nodeTypeName): string
76-
{
77-
return str_replace('.', '-', $nodeTypeName);
78-
}
79-
8068
/**
8169
* @return Result
8270
*/

Classes/Driver/NodeTypeMappingBuilderInterface.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,6 @@
2323
*/
2424
interface NodeTypeMappingBuilderInterface
2525
{
26-
27-
/**
28-
* Converts a Content Repository Node Type name into a name which can be used for an Elasticsearch Mapping
29-
*
30-
* @param string $nodeTypeName
31-
* @return string
32-
*/
33-
public function convertNodeTypeNameToMappingName(string $nodeTypeName): string;
34-
3526
/**
3627
* Builds a Mapping Collection from the configured node types
3728
*

Classes/Driver/Version6/DocumentDriver.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\AbstractDriver;
1717
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\DocumentDriverInterface;
18-
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\NodeTypeMappingBuilderInterface;
1918
use Flowpack\ElasticSearch\Domain\Model\Index;
2019
use Flowpack\ElasticSearch\Domain\Model\Mapping;
2120
use Neos\ContentRepository\Domain\Model\NodeInterface;
@@ -30,12 +29,6 @@
3029
*/
3130
class DocumentDriver extends AbstractDriver implements DocumentDriverInterface
3231
{
33-
/**
34-
* @Flow\Inject
35-
* @var NodeTypeMappingBuilderInterface
36-
*/
37-
protected $nodeTypeMappingBuilder;
38-
3932
/**
4033
* {@inheritdoc}
4134
*/
@@ -44,7 +37,7 @@ public function delete(NodeInterface $node, string $identifier): array
4437
return [
4538
[
4639
'delete' => [
47-
'_type' => $this->nodeTypeMappingBuilder->convertNodeTypeNameToMappingName($node->getNodeType()->getName()),
40+
'_type' => $node->getNodeType()->getName(),
4841
'_id' => $identifier
4942
]
5043
]
@@ -69,7 +62,7 @@ public function deleteDuplicateDocumentNotMatchingType(Index $index, string $doc
6962
],
7063
'must_not' => [
7164
'term' => [
72-
Mapping::NEOS_TYPE_FIELD => $this->nodeTypeMappingBuilder->convertNodeTypeNameToMappingName($nodeType->getName())
65+
Mapping::NEOS_TYPE_FIELD => $nodeType->getName()
7366
]
7467
]
7568
]

Classes/Driver/Version6/Mapping/NodeTypeMappingBuilder.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ public function buildMappingInformation(Index $index): MappingCollection
5858
continue;
5959
}
6060

61-
$type = $index->findType($this->convertNodeTypeNameToMappingName($nodeTypeName));
62-
$mapping = new Mapping($type);
61+
$mapping = new Mapping($index->findType($nodeTypeName));
6362
$fullConfiguration = $nodeType->getFullConfiguration();
6463
if (isset($fullConfiguration['search']['elasticSearchMapping'])) {
6564
$fullMapping = $fullConfiguration['search']['elasticSearchMapping'];

Classes/Indexer/NodeIndexer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public function indexNode(NodeInterface $node, $targetWorkspaceName = null): voi
259259
$documentIdentifier = $this->calculateDocumentIdentifier($node, $targetWorkspaceName);
260260
$nodeType = $node->getNodeType();
261261

262-
$mappingType = $this->getIndex()->findType($this->nodeTypeMappingBuilder->convertNodeTypeNameToMappingName($nodeType->getName()));
262+
$mappingType = $this->getIndex()->findType($nodeType->getName());
263263

264264
if ($this->bulkProcessing === false) {
265265
// Remove document with the same contextPathHash but different NodeType, required after NodeType change

0 commit comments

Comments
 (0)