1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 00:02:41 +01:00
phorge-phorge/src/applications/pholio/search/PholioSearchIndexer.php
epriestley 8f0bab73ef Support search indexing in ApplicationTransaction
Summary: Hook D4261 into ApplicationTransaction

Test Plan: Edited a mock; searched for it.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2104

Differential Revision: https://secure.phabricator.com/D4262
2012-12-21 14:21:50 -08:00

34 lines
910 B
PHP

<?php
/**
* @group pholio
*/
final class PholioSearchIndexer extends PhabricatorSearchDocumentIndexer {
public function getIndexableObject() {
return new PholioMock();
}
protected function buildAbstractDocumentByPHID($phid) {
$mock = $this->loadDocumentByPHID($phid);
$doc = new PhabricatorSearchAbstractDocument();
$doc->setPHID($mock->getPHID());
$doc->setDocumentType(phid_get_type($mock->getPHID()));
$doc->setDocumentTitle($mock->getName());
$doc->setDocumentCreated($mock->getDateCreated());
$doc->setDocumentModified($mock->getDateModified());
$doc->addField(
PhabricatorSearchField::FIELD_BODY,
$mock->getDescription());
$doc->addRelationship(
PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR,
$mock->getAuthorPHID(),
PhabricatorPHIDConstants::PHID_TYPE_USER,
$mock->getDateCreated());
return $doc;
}
}