protected function buildAbstractDocumentByPHID($phid) { $commit = $this->loadDocumentByPHID($phid); $commit_data = id(new PhabricatorRepositoryCommitData())->loadOneWhere('commitID = %d', $commit->getID()); $date_created = $commit->getEpoch(); $commit_message = $commit_data->getCommitMessage(); $author_phid = $commit_data->getCommitDetail('authorPHID'); $repository = id(new PhabricatorRepositoryQuery())->setViewer($this->getViewer())->withIDs(array($commit->getRepositoryID()))->executeOne(); if (!$repository) { throw new Exception(pht('No such repository!')); } $title = 'r' . $repository->getCallsign() . $commit->getCommitIdentifier() . ' ' . $commit_data->getSummary(); $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($commit->getPHID()); $doc->setDocumentType(PhabricatorRepositoryCommitPHIDType::TYPECONST); $doc->setDocumentCreated($date_created); $doc->setDocumentModified($date_created); $doc->setDocumentTitle($title); $doc->addField(PhabricatorSearchDocumentFieldType::FIELD_BODY, $commit_message); if ($author_phid) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $author_phid, PhabricatorPeopleUserPHIDType::TYPECONST, $date_created); } $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY, $repository->getPHID(), PhabricatorRepositoryRepositoryPHIDType::TYPECONST, $date_created); $this->indexTransactions($doc, new PhabricatorAuditTransactionQuery(), array($commit->getPHID())); return $doc; }
protected function buildAbstractDocumentByPHID($phid) { $rev = $this->loadDocumentByPHID($phid); $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($rev->getPHID()); $doc->setDocumentType(DifferentialRevisionPHIDType::TYPECONST); $doc->setDocumentTitle($rev->getTitle()); $doc->setDocumentCreated($rev->getDateCreated()); $doc->setDocumentModified($rev->getDateModified()); $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $rev->getAuthorPHID(), PhabricatorPeopleUserPHIDType::TYPECONST, $rev->getDateCreated()); $doc->addRelationship($rev->isClosed() ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $rev->getPHID(), DifferentialRevisionPHIDType::TYPECONST, time()); $this->indexTransactions($doc, new DifferentialTransactionQuery(), array($rev->getPHID())); // If a revision needs review, the owners are the reviewers. Otherwise, the // owner is the author (e.g., accepted, rejected, closed). if ($rev->getStatus() == ArcanistDifferentialRevisionStatus::NEEDS_REVIEW) { $reviewers = $rev->getReviewerStatus(); $reviewers = mpull($reviewers, 'getReviewerPHID', 'getReviewerPHID'); if ($reviewers) { foreach ($reviewers as $phid) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OWNER, $phid, PhabricatorPeopleUserPHIDType::TYPECONST, $rev->getDateModified()); // Bogus timestamp. } } else { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_UNOWNED, $rev->getPHID(), PhabricatorPeopleUserPHIDType::TYPECONST, $rev->getDateModified()); // Bogus timestamp. } } else { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OWNER, $rev->getAuthorPHID(), PhabricatorPHIDConstants::PHID_TYPE_VOID, $rev->getDateCreated()); } return $doc; }
public static function indexCommit(PhabricatorRepositoryCommit $commit) { $commit_data = id(new PhabricatorRepositoryCommitData())->loadOneWhere('commitID = %d', $commit->getID()); $date_created = $commit->getEpoch(); $commit_message = $commit_data->getCommitMessage(); $author_phid = $commit_data->getCommitDetail('authorPHID'); $repository = id(new PhabricatorRepository())->loadOneWhere('id = %d', $commit->getRepositoryID()); if (!$repository) { return; } $title = 'r' . $repository->getCallsign() . $commit->getCommitIdentifier() . " " . $commit_data->getSummary(); $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($commit->getPHID()); $doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_CMIT); $doc->setDocumentCreated($date_created); $doc->setDocumentModified($date_created); $doc->setDocumentTitle($title); $doc->addField(PhabricatorSearchField::FIELD_BODY, $commit_message); if ($author_phid) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $author_phid, PhabricatorPHIDConstants::PHID_TYPE_USER, $date_created); } $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY, $repository->getPHID(), PhabricatorPHIDConstants::PHID_TYPE_REPO, $date_created); $comments = id(new PhabricatorAuditComment())->loadAllWhere('targetPHID = %s', $commit->getPHID()); foreach ($comments as $comment) { if (strlen($comment->getContent())) { $doc->addField(PhabricatorSearchField::FIELD_COMMENT, $comment->getContent()); } } self::reindexAbstractDocument($doc); }
public static function indexQuestion(PonderQuestion $question) { // note: we assume someone's already called attachrelated on $question $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($question->getPHID()); $doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_QUES); $doc->setDocumentTitle($question->getTitle()); $doc->setDocumentCreated($question->getDateCreated()); $doc->setDocumentModified($question->getDateModified()); $doc->addField(PhabricatorSearchField::FIELD_BODY, $question->getContent()); $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $question->getAuthorPHID(), PhabricatorPHIDConstants::PHID_TYPE_USER, $question->getDateCreated()); $comments = $question->getComments(); foreach ($comments as $curcomment) { $doc->addField(PhabricatorSearchField::FIELD_COMMENT, $curcomment->getContent()); } $answers = $question->getAnswers(); foreach ($answers as $curanswer) { if (strlen($curanswer->getContent())) { $doc->addField(PhabricatorSearchField::FIELD_COMMENT, $curanswer->getContent()); } $answer_comments = $curanswer->getComments(); foreach ($answer_comments as $curcomment) { $doc->addField(PhabricatorSearchField::FIELD_COMMENT, $curcomment->getContent()); } } self::reindexAbstractDocument($doc); }
protected function buildAbstractDocumentByPHID($phid) { $task = $this->loadDocumentByPHID($phid); $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($task->getPHID()); $doc->setDocumentType(ManiphestTaskPHIDType::TYPECONST); $doc->setDocumentTitle($task->getTitle()); $doc->setDocumentCreated($task->getDateCreated()); $doc->setDocumentModified($task->getDateModified()); $doc->addField(PhabricatorSearchField::FIELD_BODY, $task->getDescription()); $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $task->getAuthorPHID(), PhabricatorPeopleUserPHIDType::TYPECONST, $task->getDateCreated()); $doc->addRelationship($task->isClosed() ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $task->getPHID(), ManiphestTaskPHIDType::TYPECONST, time()); $this->indexTransactions($doc, new ManiphestTransactionQuery(), array($phid)); foreach ($task->getProjectPHIDs() as $phid) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_PROJECT, $phid, PhabricatorProjectProjectPHIDType::TYPECONST, $task->getDateModified()); // Bogus. } $owner = $task->getOwnerPHID(); if ($owner) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OWNER, $owner, PhabricatorPeopleUserPHIDType::TYPECONST, time()); } else { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_UNOWNED, $task->getPHID(), PhabricatorPHIDConstants::PHID_TYPE_VOID, $task->getDateCreated()); } // We need to load handles here since non-users may subscribe (mailing // lists, e.g.) $ccs = $task->getCCPHIDs(); $handles = id(new PhabricatorHandleQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withPHIDs($ccs)->execute(); foreach ($ccs as $cc) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_SUBSCRIBER, $handles[$cc]->getPHID(), $handles[$cc]->getType(), time()); } return $doc; }
protected function buildAbstractDocumentByPHID($phid) { $user = $this->loadDocumentByPHID($phid); $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($user->getPHID()); $doc->setDocumentType(PhabricatorPeopleUserPHIDType::TYPECONST); $doc->setDocumentTitle($user->getFullName()); $doc->setDocumentCreated($user->getDateCreated()); $doc->setDocumentModified($user->getDateModified()); $doc->addRelationship($user->isUserActivated() ? PhabricatorSearchRelationship::RELATIONSHIP_OPEN : PhabricatorSearchRelationship::RELATIONSHIP_CLOSED, $user->getPHID(), PhabricatorPeopleUserPHIDType::TYPECONST, time()); return $doc; }
public static function indexUser(PhabricatorUser $user) { $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($user->getPHID()); $doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_USER); $doc->setDocumentTitle($user->getUserName() . '(' . $user->getRealName() . ')'); $doc->setDocumentCreated($user->getDateCreated()); $doc->setDocumentModified($user->getDateModified()); // TODO: Index the blurbs from their profile or something? Probably not // actually useful... PhabricatorSearchDocument::reindexAbstractDocument($doc); }
protected function buildAbstractDocumentByPHID($phid) { $credential = $this->loadDocumentByPHID($phid); $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($credential->getPHID()); $doc->setDocumentType(PassphraseCredentialPHIDType::TYPECONST); $doc->setDocumentTitle($credential->getName()); $doc->setDocumentCreated($credential->getDateCreated()); $doc->setDocumentModified($credential->getDateModified()); $doc->addField(PhabricatorSearchDocumentFieldType::FIELD_BODY, $credential->getDescription()); $doc->addRelationship($credential->getIsDestroyed() ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $credential->getPHID(), PassphraseCredentialPHIDType::TYPECONST, time()); $this->indexTransactions($doc, new PassphraseCredentialTransactionQuery(), array($phid)); return $doc; }
public static function indexDocument(PhrictionDocument $document) { $content = $document->getContent(); $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($document->getPHID()); $doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_WIKI); $doc->setDocumentTitle($content->getTitle()); // TODO: This isn't precisely correct, denormalize into the Document table? $doc->setDocumentCreated($content->getDateCreated()); $doc->setDocumentModified($content->getDateModified()); $doc->addField(PhabricatorSearchField::FIELD_BODY, $content->getContent()); $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $content->getAuthorPHID(), PhabricatorPHIDConstants::PHID_TYPE_USER, $content->getDateCreated()); self::reindexAbstractDocument($doc); }
protected function buildAbstractDocumentByPHID($phid) { $project = $this->loadDocumentByPHID($phid); $project->updateDatasourceTokens(); $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($project->getPHID()); $doc->setDocumentType(PhabricatorProjectProjectPHIDType::TYPECONST); $doc->setDocumentTitle($project->getName()); $doc->setDocumentCreated($project->getDateCreated()); $doc->setDocumentModified($project->getDateModified()); $doc->addRelationship($project->isArchived() ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $project->getPHID(), PhabricatorProjectProjectPHIDType::TYPECONST, time()); // NOTE: This could be more full-featured, but for now we're mostly // interested in the side effects of indexing. return $doc; }
public static function indexUser(PhabricatorUser $user) { $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($user->getPHID()); $doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_USER); $doc->setDocumentTitle($user->getUserName() . ' (' . $user->getRealName() . ')'); $doc->setDocumentCreated($user->getDateCreated()); $doc->setDocumentModified($user->getDateModified()); // TODO: Index the blurbs from their profile or something? Probably not // actually useful... if (!$user->getIsDisabled()) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $user->getPHID(), PhabricatorPHIDConstants::PHID_TYPE_USER, time()); } self::reindexAbstractDocument($doc); }
protected function buildAbstractDocumentByPHID($phid) { $event = $this->loadDocumentByPHID($phid); $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($event->getPHID()); $doc->setDocumentType(PhabricatorCalendarEventPHIDType::TYPECONST); $doc->setDocumentTitle($event->getName()); $doc->setDocumentCreated($event->getDateCreated()); $doc->setDocumentModified($event->getDateModified()); $doc->addField(PhabricatorSearchDocumentFieldType::FIELD_BODY, $event->getDescription()); $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $event->getUserPHID(), PhabricatorPeopleUserPHIDType::TYPECONST, $event->getDateCreated()); $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OWNER, $event->getUserPHID(), PhabricatorPeopleUserPHIDType::TYPECONST, $event->getDateCreated()); $doc->addRelationship($event->getIsCancelled() ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $event->getPHID(), PhabricatorCalendarEventPHIDType::TYPECONST, time()); $this->indexTransactions($doc, new PhabricatorCalendarEventTransactionQuery(), array($phid)); return $doc; }
public static function indexRevision(DifferentialRevision $rev) { $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($rev->getPHID()); $doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_DREV); $doc->setDocumentTitle($rev->getTitle()); $doc->setDocumentCreated($rev->getDateCreated()); $doc->setDocumentModified($rev->getDateModified()); $doc->addField(PhabricatorSearchField::FIELD_BODY, $rev->getSummary()); $doc->addField(PhabricatorSearchField::FIELD_TEST_PLAN, $rev->getTestPlan()); $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $rev->getAuthorPHID(), PhabricatorPHIDConstants::PHID_TYPE_USER, $rev->getDateCreated()); if ($rev->getStatus() != ArcanistDifferentialRevisionStatus::CLOSED && $rev->getStatus() != ArcanistDifferentialRevisionStatus::ABANDONED) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $rev->getPHID(), PhabricatorPHIDConstants::PHID_TYPE_DREV, time()); } $comments = id(new DifferentialComment())->loadAllWhere('revisionID = %d', $rev->getID()); $inlines = id(new DifferentialInlineComment())->loadAllWhere('revisionID = %d AND commentID IS NOT NULL', $rev->getID()); $touches = array(); foreach (array_merge($comments, $inlines) as $comment) { if (strlen($comment->getContent())) { $doc->addField(PhabricatorSearchField::FIELD_COMMENT, $comment->getContent()); } $author = $comment->getAuthorPHID(); $touches[$author] = $comment->getDateCreated(); } foreach ($touches as $touch => $time) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_TOUCH, $touch, PhabricatorPHIDConstants::PHID_TYPE_USER, $time); } $rev->loadRelationships(); // If a revision needs review, the owners are the reviewers. Otherwise, the // owner is the author (e.g., accepted, rejected, closed). if ($rev->getStatus() == ArcanistDifferentialRevisionStatus::NEEDS_REVIEW) { foreach ($rev->getReviewers() as $phid) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OWNER, $phid, PhabricatorPHIDConstants::PHID_TYPE_USER, $rev->getDateModified()); // Bogus timestamp. } } else { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OWNER, $rev->getAuthorPHID(), PhabricatorPHIDConstants::PHID_TYPE_USER, $rev->getDateCreated()); } $ccphids = $rev->getCCPHIDs(); $handles = id(new PhabricatorObjectHandleData($ccphids))->loadHandles(); foreach ($handles as $phid => $handle) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_SUBSCRIBER, $phid, $handle->getType(), $rev->getDateModified()); // Bogus timestamp. } self::reindexAbstractDocument($doc); }
protected function buildAbstractDocumentByPHID($phid) { $document = $this->loadDocumentByPHID($phid); $content = id(new PhrictionContent())->load($document->getContentID()); $document->attachContent($content); $content = $document->getContent(); $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($document->getPHID()); $doc->setDocumentType(PhrictionDocumentPHIDType::TYPECONST); $doc->setDocumentTitle($content->getTitle()); // TODO: This isn't precisely correct, denormalize into the Document table? $doc->setDocumentCreated($content->getDateCreated()); $doc->setDocumentModified($content->getDateModified()); $doc->addField(PhabricatorSearchField::FIELD_BODY, $content->getContent()); $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $content->getAuthorPHID(), PhabricatorPeopleUserPHIDType::TYPECONST, $content->getDateCreated()); $doc->addRelationship($document->getStatus() == PhrictionDocumentStatus::STATUS_EXISTS ? PhabricatorSearchRelationship::RELATIONSHIP_OPEN : PhabricatorSearchRelationship::RELATIONSHIP_CLOSED, $document->getPHID(), PhrictionDocumentPHIDType::TYPECONST, time()); return $doc; }
protected function buildAbstractDocumentByPHID($phid) { $task = $this->loadDocumentByPHID($phid); $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($task->getPHID()); $doc->setDocumentType(ManiphestTaskPHIDType::TYPECONST); $doc->setDocumentTitle($task->getTitle()); $doc->setDocumentCreated($task->getDateCreated()); $doc->setDocumentModified($task->getDateModified()); $doc->addField(PhabricatorSearchDocumentFieldType::FIELD_BODY, $task->getDescription()); $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $task->getAuthorPHID(), PhabricatorPeopleUserPHIDType::TYPECONST, $task->getDateCreated()); $doc->addRelationship($task->isClosed() ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $task->getPHID(), ManiphestTaskPHIDType::TYPECONST, time()); $this->indexTransactions($doc, new ManiphestTransactionQuery(), array($phid)); $owner = $task->getOwnerPHID(); if ($owner) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OWNER, $owner, PhabricatorPeopleUserPHIDType::TYPECONST, time()); } else { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_UNOWNED, $task->getPHID(), PhabricatorPHIDConstants::PHID_TYPE_VOID, $task->getDateCreated()); } return $doc; }
public static function indexQuestion(PonderQuestion $question) { $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($question->getPHID()); $doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_QUES); $doc->setDocumentTitle($question->getTitle()); $doc->setDocumentCreated($question->getDateCreated()); $doc->setDocumentModified($question->getDateModified()); $doc->addField(PhabricatorSearchField::FIELD_BODY, $question->getContent()); $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $question->getAuthorPHID(), PhabricatorPHIDConstants::PHID_TYPE_USER, $question->getDateCreated()); $answers = $question->getAnswers(); $touches = array(); foreach ($answers as $comment) { if (strlen($comment->getContent())) { $doc->addField(PhabricatorSearchField::FIELD_COMMENT, $comment->getContent()); } $author = $comment->getAuthorPHID(); $touches[$author] = $comment->getDateCreated(); } self::reindexAbstractDocument($doc); }
public function reconstructDocument($phid) { $type = phid_get_type($phid); $response = $this->executeRequest("/phabricator/{$type}/{$phid}", array()); if (empty($response['exists'])) { return null; } $hit = $response['_source']; $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($phid); $doc->setDocumentType($response['_type']); $doc->setDocumentTitle($hit['title']); $doc->setDocumentCreated($hit['dateCreated']); $doc->setDocumentModified($hit['_timestamp']); foreach ($hit['field'] as $fdef) { $doc->addField($fdef['type'], $fdef['corpus'], $fdef['aux']); } foreach ($hit['relationship'] as $rtype => $rships) { foreach ($rships as $rship) { $doc->addRelationship($rtype, $rship['phid'], $rship['phidType'], $rship['when']); } } return $doc; }
public static function indexTask(ManiphestTask $task) { $doc = new PhabricatorSearchAbstractDocument(); $doc->setPHID($task->getPHID()); $doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_TASK); $doc->setDocumentTitle($task->getTitle()); $doc->setDocumentCreated($task->getDateCreated()); $doc->setDocumentModified($task->getDateModified()); $doc->addField(PhabricatorSearchField::FIELD_BODY, $task->getDescription()); $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $task->getAuthorPHID(), PhabricatorPHIDConstants::PHID_TYPE_USER, $task->getDateCreated()); if ($task->getStatus() == ManiphestTaskStatus::STATUS_OPEN) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OPEN, $task->getPHID(), PhabricatorPHIDConstants::PHID_TYPE_TASK, time()); } $transactions = id(new ManiphestTransaction())->loadAllWhere('taskID = %d', $task->getID()); $current_ccs = $task->getCCPHIDs(); $touches = array(); $owner = null; $ccs = array(); foreach ($transactions as $transaction) { if ($transaction->hasComments()) { $doc->addField(PhabricatorSearchField::FIELD_COMMENT, $transaction->getComments()); } $author = $transaction->getAuthorPHID(); // Record the most recent time they touched this object. $touches[$author] = $transaction->getDateCreated(); switch ($transaction->getTransactionType()) { case ManiphestTransactionType::TYPE_OWNER: $owner = $transaction; break; case ManiphestTransactionType::TYPE_CCS: // For users who are still CC'd, record the first time they were // added to CC. foreach ($transaction->getNewValue() as $added_cc) { if (in_array($added_cc, $current_ccs)) { if (empty($ccs[$added_cc])) { $ccs[$added_cc] = $transaction->getDateCreated(); } } } break; } } foreach ($task->getProjectPHIDs() as $phid) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_PROJECT, $phid, PhabricatorPHIDConstants::PHID_TYPE_PROJ, $task->getDateModified()); // Bogus. } if ($owner && $owner->getNewValue()) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OWNER, $owner->getNewValue(), PhabricatorPHIDConstants::PHID_TYPE_USER, $owner->getDateCreated()); } else { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_OWNER, ManiphestTaskOwner::OWNER_UP_FOR_GRABS, PhabricatorPHIDConstants::PHID_TYPE_MAGIC, $owner ? $owner->getDateCreated() : $task->getDateCreated()); } foreach ($touches as $touch => $time) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_TOUCH, $touch, PhabricatorPHIDConstants::PHID_TYPE_USER, $time); } // We need to load handles here since non-users may subscribe (mailing // lists, e.g.) $handles = id(new PhabricatorObjectHandleData(array_keys($ccs)))->loadHandles(); foreach ($ccs as $cc => $time) { $doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_SUBSCRIBER, $handles[$cc]->getPHID(), $handles[$cc]->getType(), $time); } self::reindexAbstractDocument($doc); }