/**
  * Index a new document with permissions
  *
  * @param Docman_Item    $item    The docman item
  * @param Docman_Version $version The version to index
  *
  * @throws FullTextSearchDocmanIndexFileTooBigException
  */
 public function indexNewVersion(Docman_Item $item, Docman_Version $version)
 {
     try {
         $this->client->getIndexedElement($item->getGroupId(), $item->getId());
         $this->logger->debug('index new version #' . $version->getId() . ' for document #' . $item->getId());
         $update_data = array();
         if (filesize($version->getPath()) > $this->max_indexed_file_size) {
             throw new FullTextSearchDocmanIndexFileTooBigException($item->getId());
         }
         $this->request_data_factory->updateFile($update_data, $version->getPath());
         $this->client->update($item->getGroupId(), $item->getId(), $update_data);
     } catch (ElasticSearch_ElementNotIndexed $exception) {
         $this->indexNewDocument($item, $version);
         return;
     }
 }
 /**
  * Physically remove the given version from the filesystem
  *
  * @param Docman_Version $version
  *
  * @return Boolean
  */
 public function purgeDeletedVersion($version)
 {
     if (file_exists($version->getPath()) && $this->physicalDeleteVersion($version->getPath())) {
         $dao = $this->_getVersionDao();
         return $dao->setPurgeDate($version->getId(), time());
     }
     return false;
 }