Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15431495
D10682.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D10682.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -684,6 +684,7 @@
'FundInitiativeCloseController' => 'applications/fund/controller/FundInitiativeCloseController.php',
'FundInitiativeEditController' => 'applications/fund/controller/FundInitiativeEditController.php',
'FundInitiativeEditor' => 'applications/fund/editor/FundInitiativeEditor.php',
+ 'FundInitiativeIndexer' => 'applications/fund/search/FundInitiativeIndexer.php',
'FundInitiativeListController' => 'applications/fund/controller/FundInitiativeListController.php',
'FundInitiativePHIDType' => 'applications/fund/phid/FundInitiativePHIDType.php',
'FundInitiativeQuery' => 'applications/fund/query/FundInitiativeQuery.php',
@@ -3579,6 +3580,7 @@
'FundInitiativeCloseController' => 'FundController',
'FundInitiativeEditController' => 'FundController',
'FundInitiativeEditor' => 'PhabricatorApplicationTransactionEditor',
+ 'FundInitiativeIndexer' => 'PhabricatorSearchDocumentIndexer',
'FundInitiativeListController' => 'FundController',
'FundInitiativePHIDType' => 'PhabricatorPHIDType',
'FundInitiativeQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
diff --git a/src/applications/fund/editor/FundInitiativeEditor.php b/src/applications/fund/editor/FundInitiativeEditor.php
--- a/src/applications/fund/editor/FundInitiativeEditor.php
+++ b/src/applications/fund/editor/FundInitiativeEditor.php
@@ -277,6 +277,8 @@
return true;
}
-
+ protected function supportsSearch() {
+ return true;
+ }
}
diff --git a/src/applications/fund/search/FundInitiativeIndexer.php b/src/applications/fund/search/FundInitiativeIndexer.php
new file mode 100644
--- /dev/null
+++ b/src/applications/fund/search/FundInitiativeIndexer.php
@@ -0,0 +1,58 @@
+<?php
+
+final class FundInitiativeIndexer
+ extends PhabricatorSearchDocumentIndexer {
+
+ public function getIndexableObject() {
+ return new FundInitiative();
+ }
+
+ protected function loadDocumentByPHID($phid) {
+ $object = id(new FundInitiativeQuery())
+ ->setViewer($this->getViewer())
+ ->withPHIDs(array($phid))
+ ->executeOne();
+ if (!$object) {
+ throw new Exception("Unable to load object by phid '{$phid}'!");
+ }
+ return $object;
+ }
+
+ protected function buildAbstractDocumentByPHID($phid) {
+ $initiative = $this->loadDocumentByPHID($phid);
+
+ $doc = id(new PhabricatorSearchAbstractDocument())
+ ->setPHID($initiative->getPHID())
+ ->setDocumentType(FundInitiativePHIDType::TYPECONST)
+ ->setDocumentTitle($initiative->getName())
+ ->setDocumentCreated($initiative->getDateCreated())
+ ->setDocumentModified($initiative->getDateModified());
+
+ $doc->addRelationship(
+ PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR,
+ $initiative->getOwnerPHID(),
+ PhabricatorPeopleUserPHIDType::TYPECONST,
+ $initiative->getDateCreated());
+
+ $doc->addRelationship(
+ PhabricatorSearchRelationship::RELATIONSHIP_OWNER,
+ $initiative->getOwnerPHID(),
+ PhabricatorPeopleUserPHIDType::TYPECONST,
+ $initiative->getDateCreated());
+
+ $doc->addRelationship(
+ $initiative->isClosed()
+ ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED
+ : PhabricatorSearchRelationship::RELATIONSHIP_OPEN,
+ $initiative->getPHID(),
+ FundInitiativePHIDType::TYPECONST,
+ time());
+
+ $this->indexTransactions(
+ $doc,
+ new FundInitiativeTransactionQuery(),
+ array($initiative->getPHID()));
+
+ return $doc;
+ }
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 25, 12:37 PM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7587702
Default Alt Text
D10682.diff (3 KB)
Attached To
Mode
D10682: Allow Fund initiatives to be searched for
Attached
Detach File
Event Timeline
Log In to Comment