mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-26 15:30:58 +01:00
69d12f64ba
Summary: Fixes T8352. Associate Diviner books and atoms with a repository. This relationship is not really surfaced anywhere in the UI but provides metadata that contextualises search results. Depends on D13091. Test Plan: Ran `diviner generate --repository ARC` and then went to `/diviner/book/arcanist/`. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7703, T8352 Differential Revision: https://secure.phabricator.com/D13070
36 lines
913 B
PHP
36 lines
913 B
PHP
<?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;
|
|
}
|
|
|
|
|
|
}
|