/**
  * @return PostSummaryCollection
  */
 public function getCollection()
 {
     return PostSummaryCollection::newFromRevision($this);
 }
 /**
  * {@inheritDoc}
  */
 public function buildDocument($revision)
 {
     /** @var PostRevision $revision */
     // get timestamp from the most recent revision
     $updateTimestamp = $revision->getCollection()->getWorkflow()->getLastModifiedObj();
     // timestamp for initial topic post
     $creationTimestamp = $revision->getCollectionId()->getTimestampObj();
     // get content from all child posts in a [post id => [data]] array
     $revisions = $this->getRevisionsData($revision);
     // find summary for this topic & add it as revision
     $summaryCollection = PostSummaryCollection::newFromId($revision->getCollectionId());
     try {
         /** @var PostSummary $summaryRevision */
         $summaryRevision = $summaryCollection->getLastRevision();
         $data = current($this->getRevisionsData($summaryRevision));
         if ($data !== false) {
             $revisions[] = $data;
         }
     } catch (\Exception $e) {
         // no summary - that's ok!
     }
     // get board title associated with this revision
     $title = $revision->getCollection()->getWorkflow()->getOwnerTitle();
     $doc = new \Elastica\Document($revision->getCollectionId()->getAlphadecimal(), array('namespace' => $title->getNamespace(), 'namespace_text' => $title->getPageLanguage()->getFormattedNsText($title->getNamespace()), 'pageid' => $title->getArticleID(), 'title' => $title->getText(), 'timestamp' => $creationTimestamp->getTimestamp(TS_ISO_8601), 'update_timestamp' => $updateTimestamp->getTimestamp(TS_ISO_8601), 'revisions' => $revisions));
     return $doc;
 }