@@ -278,7 +278,7 @@ public function indexNode(Node $node, $targetWorkspaceName = NULL) {
278278 );
279279 }
280280
281- $ this ->updateFulltext ($ node , $ fulltextIndexOfNode );
281+ $ this ->updateFulltext ($ node , $ fulltextIndexOfNode, $ targetWorkspaceName );
282282 }
283283
284284 $ this ->logger ->log (sprintf ('NodeIndexer: Added / updated node %s. ID: %s ' , $ contextPath , $ contextPathHash ), LOG_DEBUG , NULL , 'ElasticSearch (CR) ' );
@@ -289,11 +289,11 @@ public function indexNode(Node $node, $targetWorkspaceName = NULL) {
289289 *
290290 * @param Node $node
291291 * @param array $fulltextIndexOfNode
292+ * @param string $targetWorkspaceName
292293 * @return void
293294 */
294- protected function updateFulltext (Node $ node , array $ fulltextIndexOfNode ) {
295- if ($ node ->getWorkspace ()->getName () !== 'live ' || count ($ fulltextIndexOfNode ) === 0 ) {
296- // fulltext indexing should only be done in live workspace, and if there's something to index
295+ protected function updateFulltext (Node $ node , array $ fulltextIndexOfNode , $ targetWorkspaceName = NULL ) {
296+ if ((($ targetWorkspaceName !== NULL && $ targetWorkspaceName !== 'live ' ) || $ node ->getWorkspace ()->getName () !== 'live ' ) || count ($ fulltextIndexOfNode ) === 0 ) {
297297 return ;
298298 }
299299
@@ -307,11 +307,14 @@ protected function updateFulltext(Node $node, array $fulltextIndexOfNode) {
307307 }
308308 }
309309
310+ $ closestFulltextNodeContextPath = str_replace ($ closestFulltextNode ->getContext ()->getWorkspace ()->getName (), 'live ' , $ closestFulltextNode ->getContextPath ());
311+ $ closestFulltextNodeContextPathHash = sha1 ($ closestFulltextNodeContextPath );
312+
310313 $ this ->currentBulkRequest [] = array (
311314 array (
312315 'update ' => array (
313316 '_type ' => NodeTypeMappingBuilder::convertNodeTypeNameToMappingName ($ closestFulltextNode ->getNodeType ()->getName ()),
314- '_id ' => sha1 ( $ closestFulltextNode -> getContextPath ())
317+ '_id ' => $ closestFulltextNodeContextPathHash
315318 )
316319 ),
317320 // http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-update.html
0 commit comments