mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-26 13:39:08 +01:00
Summary: Closes T7937, Calendar events should be supported in global search. Test Plan: Search for part of calendar event title in global search, event should be in search results. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7937 Differential Revision: https://secure.phabricator.com/D12636
52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
<?php
|
|
|
|
final class PhabricatorCalendarEventSearchIndexer
|
|
extends PhabricatorSearchDocumentIndexer {
|
|
|
|
public function getIndexableObject() {
|
|
return new PhabricatorCalendarEvent();
|
|
}
|
|
|
|
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(
|
|
PhabricatorSearchField::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;
|
|
}
|
|
|
|
}
|