[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class ManiphestSearchIndexer extends PhabricatorSearchDocumentIndexer { 4 5 public function getIndexableObject() { 6 return new ManiphestTask(); 7 } 8 9 protected function buildAbstractDocumentByPHID($phid) { 10 $task = $this->loadDocumentByPHID($phid); 11 12 $doc = new PhabricatorSearchAbstractDocument(); 13 $doc->setPHID($task->getPHID()); 14 $doc->setDocumentType(ManiphestTaskPHIDType::TYPECONST); 15 $doc->setDocumentTitle($task->getTitle()); 16 $doc->setDocumentCreated($task->getDateCreated()); 17 $doc->setDocumentModified($task->getDateModified()); 18 19 $doc->addField( 20 PhabricatorSearchField::FIELD_BODY, 21 $task->getDescription()); 22 23 $doc->addRelationship( 24 PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, 25 $task->getAuthorPHID(), 26 PhabricatorPeopleUserPHIDType::TYPECONST, 27 $task->getDateCreated()); 28 29 $doc->addRelationship( 30 $task->isClosed() 31 ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED 32 : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, 33 $task->getPHID(), 34 ManiphestTaskPHIDType::TYPECONST, 35 time()); 36 37 $this->indexTransactions( 38 $doc, 39 new ManiphestTransactionQuery(), 40 array($phid)); 41 42 $owner = $task->getOwnerPHID(); 43 if ($owner) { 44 $doc->addRelationship( 45 PhabricatorSearchRelationship::RELATIONSHIP_OWNER, 46 $owner, 47 PhabricatorPeopleUserPHIDType::TYPECONST, 48 time()); 49 } else { 50 $doc->addRelationship( 51 PhabricatorSearchRelationship::RELATIONSHIP_UNOWNED, 52 $task->getPHID(), 53 PhabricatorPHIDConstants::PHID_TYPE_VOID, 54 $task->getDateCreated()); 55 } 56 57 // We need to load handles here since non-users may subscribe (mailing 58 // lists, e.g.) 59 $ccs = $task->getCCPHIDs(); 60 $handles = id(new PhabricatorHandleQuery()) 61 ->setViewer(PhabricatorUser::getOmnipotentUser()) 62 ->withPHIDs($ccs) 63 ->execute(); 64 foreach ($ccs as $cc) { 65 $doc->addRelationship( 66 PhabricatorSearchRelationship::RELATIONSHIP_SUBSCRIBER, 67 $handles[$cc]->getPHID(), 68 $handles[$cc]->getType(), 69 time()); 70 } 71 72 return $doc; 73 } 74 75 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |