Path: blob/master/src/applications/differential/search/DifferentialRevisionFulltextEngine.php
12256 views
<?php12final class DifferentialRevisionFulltextEngine3extends PhabricatorFulltextEngine {45protected function buildAbstractDocument(6PhabricatorSearchAbstractDocument $document,7$object) {89$revision = id(new DifferentialRevisionQuery())10->setViewer($this->getViewer())11->withPHIDs(array($object->getPHID()))12->needReviewers(true)13->executeOne();1415// TODO: This isn't very clean, but custom fields currently rely on it.16$object->attachReviewers($revision->getReviewers());1718$document->setDocumentTitle($revision->getTitle());1920$document->addRelationship(21PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR,22$revision->getAuthorPHID(),23PhabricatorPeopleUserPHIDType::TYPECONST,24$revision->getDateCreated());2526$document->addRelationship(27$revision->isClosed()28? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED29: PhabricatorSearchRelationship::RELATIONSHIP_OPEN,30$revision->getPHID(),31DifferentialRevisionPHIDType::TYPECONST,32PhabricatorTime::getNow());3334// If a revision needs review, the owners are the reviewers. Otherwise, the35// owner is the author (e.g., accepted, rejected, closed).36if ($revision->isNeedsReview()) {37$reviewers = $revision->getReviewerPHIDs();38$reviewers = array_fuse($reviewers);3940if ($reviewers) {41foreach ($reviewers as $phid) {42$document->addRelationship(43PhabricatorSearchRelationship::RELATIONSHIP_OWNER,44$phid,45PhabricatorPeopleUserPHIDType::TYPECONST,46$revision->getDateModified()); // Bogus timestamp.47}48} else {49$document->addRelationship(50PhabricatorSearchRelationship::RELATIONSHIP_UNOWNED,51$revision->getPHID(),52PhabricatorPeopleUserPHIDType::TYPECONST,53$revision->getDateModified()); // Bogus timestamp.54}55} else {56$document->addRelationship(57PhabricatorSearchRelationship::RELATIONSHIP_OWNER,58$revision->getAuthorPHID(),59PhabricatorPHIDConstants::PHID_TYPE_VOID,60$revision->getDateCreated());61}62}63}646566