Skip to content

Commit 4516b32

Browse files
committed
BUGFIX: Make sure __fulltextParts and __fulltext are of type map
For yet unknown reasons, __fulltextParts and __fulltext are initialized as type ArrayList instead of HashMap and operations like containsKey() fail. The painless script now checks the type and re-initializes it if it is not a HashMap
1 parent 703372e commit 4516b32

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Classes/Driver/Version5/IndexerDriver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public function document($indexName, NodeInterface $node, ElasticSearchDocument
4747
'script' => [
4848
'lang' => 'painless',
4949
'inline' => '
50-
HashMap fulltext = (ctx._source.containsKey("__fulltext") ? ctx._source.__fulltext : new HashMap());
51-
HashMap fulltextParts = (ctx._source.containsKey("__fulltextParts") ? ctx._source.__fulltextParts : new HashMap());
50+
HashMap fulltext = (ctx._source.containsKey("__fulltext") && ctx._source.__fulltext instanceof Map ? ctx._source.__fulltext : new HashMap());
51+
HashMap fulltextParts = (ctx._source.containsKey("__fulltextParts") && ctx._source.__fulltextParts instanceof Map ? ctx._source.__fulltextParts : new HashMap());
5252
ctx._source = params.newData;
5353
ctx._source.__fulltext = fulltext;
5454
ctx._source.__fulltextParts = fulltextParts',
@@ -123,7 +123,7 @@ public function fulltext(NodeInterface $node, array $fulltextIndexOfNode, $targe
123123
'lang' => 'painless',
124124
'inline' => '
125125
ctx._source.__fulltext = new HashMap();
126-
if (!ctx._source.containsKey("__fulltextParts")) {
126+
if (!ctx._source.containsKey("__fulltextParts") || !(ctx._source.__fulltextParts instanceof Map)) {
127127
ctx._source.__fulltextParts = new HashMap();
128128
}
129129

0 commit comments

Comments
 (0)