Skip to content

Commit 9dae6d5

Browse files
committed
Merge pull request #34 from mgoldbeck/script-elastic130
[!!!][TASK] Raise ElasticSearch Version Dependency to 1.2.0 - NEEDS ADDITIONAL CONFIGURATION of ElasticSearch Please check the README to understand the relevant ElasticSearch configuration which needs to be done in elasticsearch.yaml.
2 parents 76d26a5 + fad9b1c commit 9dae6d5

2 files changed

Lines changed: 50 additions & 5 deletions

File tree

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ public function indexNode(Node $node, $targetWorkspaceName = NULL) {
200200
'params' => array(
201201
'newData' => $documentData
202202
),
203-
'upsert' => $documentData
203+
'upsert' => $documentData,
204+
'lang' => 'groovy'
205+
206+
204207
)
205208
);
206209
} else {
@@ -263,10 +266,15 @@ protected function updateFulltext(Node $node, array $fulltextIndexOfNode, $targe
263266
ctx._source.__fulltextParts = new LinkedHashMap();
264267
}
265268
ctx._source.__fulltextParts[identifier] = fulltext;
266-
267269
ctx._source.__fulltext = new LinkedHashMap();
268-
foreach (fulltextByNode : ctx._source.__fulltextParts.entrySet()) {
269-
foreach (element : fulltextByNode.value.entrySet()) {
270+
271+
Iterator fulltextByNode = ctx._source.__fulltextParts.iterator();
272+
for (fulltextByNode; fulltextByNode.hasNext();) {
273+
274+
Iterator elementIterator = fulltextByNode.next().iterator();
275+
for (elementIterator; elementIterator.hasNext();) {
276+
277+
Map.Entry<String, String> element = elementIterator.next();
270278
if (ctx._source.__fulltext.containsKey(element.key)) {
271279
ctx._source.__fulltext[element.key] += " " + element.value;
272280
} else {
@@ -284,7 +292,8 @@ protected function updateFulltext(Node $node, array $fulltextIndexOfNode, $targe
284292
'__fulltextParts' => array(
285293
$node->getIdentifier() => $fulltextIndexOfNode
286294
)
287-
)
295+
),
296+
'lang' => 'groovy'
288297
)
289298
);
290299
}

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# TYPO3 Neos ElasticSearch Adapter
22

3+
*supporting ElasticSearch Version 1.2.x and 1.3.x*
4+
35
Created by Sebastian Kurfürst; contributions by Karsten Dambekalns and Robert Lemke.
46

57
This project connects the TYPO3 Content Repository (TYPO3CR) to ElasticSearch; enabling two
@@ -30,6 +32,40 @@ Relevant Packages:
3032

3133
The configuration from Version 1 to Version 2 has changed; here's what to change:
3234

35+
**elasticsearch.yaml**
36+
37+
Due to the fact that the default scripting language has changed from marvel to groovy since elasticsearch 1.3.0,
38+
there is a need, depending on your running installation of ElasticSearch, to add following lines of configuration to your
39+
ElasticSearch Configuration File `elasticsearch.yaml`.
40+
41+
If you are using ElasticSearch version 1.2 you have also to install groovy as a plugin. To install the plugin just run
42+
the following command in the root folder of your elastic:
43+
44+
```
45+
bin/plugin -install elasticsearch/elasticsearch-lang-groovy/2.2.0.
46+
```
47+
48+
```
49+
script.disable_dynamic: false
50+
script.default_lang: groovy
51+
52+
```
53+
54+
For running with version > 1.3.x, what is recommended, it is sufficient to add following lines to your
55+
`elasticsearch.yaml`.
56+
57+
58+
```
59+
script.groovy.sandbox.class_whitelist: java.util.LinkedHashMap
60+
script.groovy.sandbox.receiver_whitelist: java.util.Iterator, java.lang.Object, java.util.Map, java.util.Map$Entry
61+
```
62+
63+
You can get further information about this topic here:
64+
65+
http://www.elasticsearch.org/blog/elasticsearch-1-3-0-released/
66+
http://www.elasticsearch.org/blog/scripting-security/
67+
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html
68+
3369
**Settings.yaml**
3470

3571
1. Change the base namespace for configuration from `Flowpack.ElasticSearch.ContentRepositoryAdaptor`

0 commit comments

Comments
 (0)