mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-25 21:19:21 +01:00
Summary: Ref T9979. This is going to become `FulltextEngine`, but pave the way for that by pulling extensions out of it. Test Plan: {F1036624} - Used `bin/search index Txxx`, saw projects, subscribers and custom fields rebuild in the index. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9979 Differential Revision: https://secure.phabricator.com/D14835
37 lines
941 B
PHP
37 lines
941 B
PHP
<?php
|
|
|
|
final class PhabricatorProjectsFulltextEngineExtension
|
|
extends PhabricatorFulltextEngineExtension {
|
|
|
|
const EXTENSIONKEY = 'projects';
|
|
|
|
public function getExtensionName() {
|
|
return pht('Projects');
|
|
}
|
|
|
|
public function shouldIndexFulltextObject($object) {
|
|
return ($object instanceof PhabricatorProjectInterface);
|
|
}
|
|
|
|
public function indexFulltextObject(
|
|
$object,
|
|
PhabricatorSearchAbstractDocument $document) {
|
|
|
|
$project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
|
$object->getPHID(),
|
|
PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
|
|
|
|
if (!$project_phids) {
|
|
return;
|
|
}
|
|
|
|
foreach ($project_phids as $project_phid) {
|
|
$document->addRelationship(
|
|
PhabricatorSearchRelationship::RELATIONSHIP_PROJECT,
|
|
$project_phid,
|
|
PhabricatorProjectProjectPHIDType::TYPECONST,
|
|
$document->getDocumentModified()); // Bogus timestamp.
|
|
}
|
|
}
|
|
|
|
}
|