Skip to content

Commit 0f54e31

Browse files
author
Robert Lemke
committed
Merge pull request #10 from Flowpack/fulltext-index-non-document-nodes
[BUGFIX] Enable fulltext indexing for non-document nodes
2 parents 73fef55 + 5d4340a commit 0f54e31

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

Classes/Flowpack/ElasticSearch/ContentRepositoryAdaptor/Indexer/NodeIndexer.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ protected function updateFulltext(NodeData $nodeData, array $fulltextIndexOfNode
294294
$closestFulltextNode = $closestFulltextNode->getParent();
295295
if ($closestFulltextNode === NULL) {
296296
// root of hierarchy, no fulltext root found anymore, abort silently...
297+
$this->logger->log('No fulltext root found for ' . $nodeData->getPath(), LOG_WARNING);
297298
return;
298299
}
299300
}
@@ -317,7 +318,11 @@ protected function updateFulltext(NodeData $nodeData, array $fulltextIndexOfNode
317318
ctx._source.__fulltext = new LinkedHashMap();
318319
foreach (fulltextByNode : ctx._source.__fulltextParts.entrySet()) {
319320
foreach (element : fulltextByNode.value.entrySet()) {
320-
ctx._source.__fulltext[element.key] += " " + element.value;
321+
if (ctx._source.__fulltext.containsKey(element.key)) {
322+
ctx._source.__fulltext[element.key] += " " + element.value;
323+
} else {
324+
ctx._source.__fulltext[element.key] = element.value;
325+
}
321326
}
322327
}
323328
',

Configuration/NodeTypes.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,57 @@
11

22
'TYPO3.Neos:Node': &node
3+
elasticSearch:
4+
fulltext:
5+
enable: true
6+
37
properties:
48

59
'__persistenceObjectIdentifier':
610
elasticSearch:
711
mapping:
812
type: string
913
index: not_analyzed
14+
include_in_all: false
1015
indexing: ${persistenceObjectIdentifier}
1116

1217
'__identifier':
1318
elasticSearch:
1419
mapping:
1520
type: string
1621
index: not_analyzed
22+
include_in_all: false
1723
indexing: ${node.getIdentifier()}
1824

1925
'__workspace':
2026
elasticSearch:
2127
mapping:
2228
type: string
2329
index: not_analyzed
30+
include_in_all: false
2431
indexing: ${node.getWorkspace().getName()}
2532

2633
'__path':
2734
elasticSearch:
2835
mapping:
2936
type: string
3037
index: not_analyzed
38+
include_in_all: false
3139
indexing: ${node.getPath()}
3240

3341
'__parentPath':
3442
elasticSearch:
3543
mapping:
3644
type: string
3745
index: not_analyzed
46+
include_in_all: false
3847
# we index *all* parent paths as separate tokens to allow for efficient searching without a prefix query
3948
indexing: ${ElasticSearch.buildAllPathPrefixes(node.getParentPath())}
4049

4150
'__sortIndex':
4251
elasticSearch:
4352
mapping:
4453
type: integer
54+
include_in_all: false
4555
indexing: ${node.getIndex()}
4656

4757
'_removed':
@@ -55,6 +65,7 @@
5565
mapping:
5666
type: string
5767
index: not_analyzed
68+
include_in_all: false
5869
indexing: ${ElasticSearch.extractNodeTypeNamesAndSupertypes(node.getNodeType())}
5970

6071
'unstructured': *node
@@ -88,7 +99,6 @@
8899
'TYPO3.Neos:Document':
89100
elasticSearch:
90101
fulltext:
91-
enable: true
92102
isRoot: true
93103
properties:
94104
'__fulltextParts':

Configuration/Settings.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Flowpack:
2424
string:
2525
mapping:
2626
type: string
27+
include_in_all: false
2728
indexing: ${value}
2829

2930
boolean:

0 commit comments

Comments
 (0)