2015-06-04 23:27:48 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DivinerBookSearchIndexer extends PhabricatorSearchDocumentIndexer {
|
|
|
|
|
|
|
|
public function getIndexableObject() {
|
|
|
|
return new DivinerLiveBook();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function buildAbstractDocumentByPHID($phid) {
|
|
|
|
$book = $this->loadDocumentByPHID($phid);
|
|
|
|
|
|
|
|
$doc = $this->newDocument($phid)
|
|
|
|
->setDocumentTitle($book->getTitle())
|
|
|
|
->setDocumentCreated($book->getDateCreated())
|
|
|
|
->setDocumentModified($book->getDateModified());
|
|
|
|
|
|
|
|
$doc->addField(
|
2015-06-05 20:01:25 +02:00
|
|
|
PhabricatorSearchDocumentFieldType::FIELD_BODY,
|
2015-06-04 23:27:48 +02:00
|
|
|
$book->getPreface());
|
|
|
|
|
2015-06-19 09:24:23 +02:00
|
|
|
$doc->addRelationship(
|
|
|
|
PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY,
|
|
|
|
$book->getRepositoryPHID(),
|
|
|
|
PhabricatorRepositoryRepositoryPHIDType::TYPECONST,
|
|
|
|
$book->getDateCreated());
|
|
|
|
|
2015-06-16 23:09:53 +02:00
|
|
|
$this->indexTransactions(
|
|
|
|
$doc,
|
|
|
|
new DivinerLiveBookTransactionQuery(),
|
|
|
|
array($phid));
|
|
|
|
|
2015-06-04 23:27:48 +02:00
|
|
|
return $doc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|