/**
  * Indexes a page.
  *
  * @param \Sfynx\CmfBundle\Entity\Page
  * @return void
  * @access    public
  *
  * @author Etienne de Longeaux <*****@*****.**>
  * @since 2012-06-11
  */
 public function indexPage(\Sfynx\CmfBundle\Entity\Page $page)
 {
     // Open the index
     self::open($this->_indexPath);
     // we set the indexation of the locale translations of the page.
     $translationPage = $page->getTranslationByLocale($this->language);
     if ($translationPage instanceof \Sfynx\CmfBundle\Entity\TranslationPage) {
         // if the page is sluggify, we get the entity associated
         $pathInfo = str_replace($this->container->get('request')->getUriForPath(''), '', $this->container->get('request')->headers->get('referer'));
         $page_options = $this->container->get('pi_app_admin.manager.page')->getPageMetaInfo($this->language, '', '', '', $pathInfo);
         if (isset($page_options['entity']) && !empty($page_options['entity'])) {
             $entity = $page_options['entity'];
             $indexValues['Title'] = $page_options['title'];
             if (is_object($entity) && method_exists($entity, "getPublishedAt") && $entity->getPublishedAt() instanceof \DateTime) {
                 $indexValues['ModDate'] = $entity->getPublishedAt()->getTimestamp();
             } elseif (is_object($entity) && method_exists($entity, "getUpdatedAt") && $entity->getUpdatedAt() instanceof \DateTime) {
                 $indexValues['ModDate'] = $entity->getUpdatedAt()->getTimestamp();
             }
         } else {
             $indexValues['ModDate'] = $translationPage->getPublishedAt()->getTimestamp();
             $indexValues['Title'] = $translationPage->getMetaTitle();
         }
         $indexValues['Key'] = "page:{$page->getId()}:{$this->language}:{$pathInfo}";
         $indexValues['Route'] = $page->getRouteName();
         $indexValues['Contents'] = $this->deleteTags(file_get_contents($this->container->get('request')->getUriForPath('') . $pathInfo));
         $indexValues['Keywords'] = $translationPage->getMetaKeywords();
         $indexValues['Subject'] = $translationPage->getMetaDescription();
         self::$_index = Indexation::index(self::$_index, 'page', $indexValues, $this->language);
     }
     // Commit the index
     self::commit();
 }