From 8f0bab73ef0dd9b14d0465a4344296d035973689 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 21 Dec 2012 14:21:50 -0800 Subject: [PATCH] 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 --- src/__phutil_library_map__.php | 2 +- .../pholio/editor/PholioMockEditor.php | 11 +++---- .../PholioSearchIndexer.php | 0 ...habricatorApplicationTransactionEditor.php | 29 ++++++++++++------- 4 files changed, 23 insertions(+), 19 deletions(-) rename src/applications/pholio/{indexer => search}/PholioSearchIndexer.php (100%) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 6b7326d789..d268311173 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1265,7 +1265,7 @@ phutil_register_library_map(array( 'PholioMockQuery' => 'applications/pholio/query/PholioMockQuery.php', 'PholioMockViewController' => 'applications/pholio/controller/PholioMockViewController.php', 'PholioReplyHandler' => 'applications/pholio/mail/PholioReplyHandler.php', - 'PholioSearchIndexer' => 'applications/pholio/indexer/PholioSearchIndexer.php', + 'PholioSearchIndexer' => 'applications/pholio/search/PholioSearchIndexer.php', 'PholioTransaction' => 'applications/pholio/storage/PholioTransaction.php', 'PholioTransactionComment' => 'applications/pholio/storage/PholioTransactionComment.php', 'PholioTransactionQuery' => 'applications/pholio/query/PholioTransactionQuery.php', diff --git a/src/applications/pholio/editor/PholioMockEditor.php b/src/applications/pholio/editor/PholioMockEditor.php index 1583b02be5..770dcc84f9 100644 --- a/src/applications/pholio/editor/PholioMockEditor.php +++ b/src/applications/pholio/editor/PholioMockEditor.php @@ -16,13 +16,6 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor { return $types; } - protected function didApplyTransactions( - PhabricatorLiskDAO $object, - array $xactions) { -// PholioIndexer::indexMock($mock); - return; - } - protected function getCustomTransactionOldValue( PhabricatorLiskDAO $object, PhabricatorApplicationTransaction $xaction) { @@ -129,4 +122,8 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor { return true; } + protected function supportsSearch() { + return true; + } + } diff --git a/src/applications/pholio/indexer/PholioSearchIndexer.php b/src/applications/pholio/search/PholioSearchIndexer.php similarity index 100% rename from src/applications/pholio/indexer/PholioSearchIndexer.php rename to src/applications/pholio/search/PholioSearchIndexer.php diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 3d99a4aef0..e5ccdebc8c 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -1,8 +1,9 @@ contentSource; } - protected function didApplyTransactions( - PhabricatorLiskDAO $object, - array $xactions) { - return; - } - final public function applyTransactions( PhabricatorLiskDAO $object, array $xactions) { @@ -278,7 +273,10 @@ abstract class PhabricatorApplicationTransactionEditor $mail = $this->sendMail($object, $xactions); } - // TODO: Index object. + if ($this->supportsSearch()) { + id(new PhabricatorSearchIndexer()) + ->indexDocumentByPHID($object->getPHID()); + } if ($this->supportsFeed()) { $mailed = array(); @@ -291,8 +289,6 @@ abstract class PhabricatorApplicationTransactionEditor $mailed); } - $this->didApplyTransactions($object, $xactions); - return $xactions; } @@ -877,4 +873,15 @@ abstract class PhabricatorApplicationTransactionEditor ->publish(); } + +/* -( Search Index )------------------------------------------------------- */ + + + /** + * @task search + */ + protected function supportsSearch() { + return false; + } + }