1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-14 00:31:05 +01:00
phorge-phorge/src/applications/diviner/search/DivinerBookSearchIndexer.php

37 lines
913 B
PHP
Raw Normal View History

<?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(
PhabricatorSearchDocumentFieldType::FIELD_BODY,
$book->getPreface());
$doc->addRelationship(
PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY,
$book->getRepositoryPHID(),
PhabricatorRepositoryRepositoryPHIDType::TYPECONST,
$book->getDateCreated());
$this->indexTransactions(
$doc,
new DivinerLiveBookTransactionQuery(),
array($phid));
return $doc;
}
}