/** * Create a search document for a page * * @param NodeTranslation $nodeTranslation * @param Node $node * @param NodeVersion $publicNodeVersion * @param HasNodeInterface $page */ protected function addPageToIndex(NodeTranslation $nodeTranslation, Node $node, NodeVersion $publicNodeVersion, HasNodeInterface $page) { $rootNode = $this->currentTopNode; if (!$rootNode) { // Fetch main parent of current node... $rootNode = $this->em->getRepository('KunstmaanNodeBundle:Node')->getRootNodeFor($node, $nodeTranslation->getLang()); } $doc = array('root_id' => $rootNode->getId(), 'node_id' => $node->getId(), 'node_translation_id' => $nodeTranslation->getId(), 'node_version_id' => $publicNodeVersion->getId(), 'title' => $nodeTranslation->getTitle(), 'lang' => $nodeTranslation->getLang(), 'slug' => $nodeTranslation->getFullSlug(), 'page_class' => ClassLookup::getClass($page), 'created' => $this->getUTCDateTime($nodeTranslation->getCreated())->format(\DateTime::ISO8601), 'updated' => $this->getUTCDateTime($nodeTranslation->getUpdated())->format(\DateTime::ISO8601)); if ($this->logger) { $this->logger->info('Indexing document : ' . implode(', ', $doc)); } // Permissions $this->addPermissions($node, $doc); // Search type $this->addSearchType($page, $doc); // Analyzer field $this->addAnalyzer($nodeTranslation, $doc); // Parent and Ancestors $this->addParentAndAncestors($node, $doc); // Content $this->addPageContent($nodeTranslation, $page, $doc); // Add document to index $uid = 'nodetranslation_' . $nodeTranslation->getId(); $this->addBoost($node, $page, $doc); $this->addCustomData($page, $doc); $this->documents[] = $this->searchProvider->createDocument($uid, $doc, $this->indexName, $this->indexType . '_' . $nodeTranslation->getLang()); }