diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 4f5eb4caa6..971b9be04c 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3792,6 +3792,7 @@ phutil_register_library_map(array( 'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php', 'PhamePostEditEngine' => 'applications/phame/editor/PhamePostEditEngine.php', 'PhamePostEditor' => 'applications/phame/editor/PhamePostEditor.php', + 'PhamePostFulltextEngine' => 'applications/phame/search/PhamePostFulltextEngine.php', 'PhamePostHistoryController' => 'applications/phame/controller/post/PhamePostHistoryController.php', 'PhamePostListController' => 'applications/phame/controller/post/PhamePostListController.php', 'PhamePostListView' => 'applications/phame/view/PhamePostListView.php', @@ -8655,6 +8656,7 @@ phutil_register_library_map(array( 'PhabricatorDestructibleInterface', 'PhabricatorTokenReceiverInterface', 'PhabricatorConduitResultInterface', + 'PhabricatorFulltextInterface', ), 'PhamePostArchiveController' => 'PhamePostController', 'PhamePostCommentController' => 'PhamePostController', @@ -8663,6 +8665,7 @@ phutil_register_library_map(array( 'PhamePostEditController' => 'PhamePostController', 'PhamePostEditEngine' => 'PhabricatorEditEngine', 'PhamePostEditor' => 'PhabricatorApplicationTransactionEditor', + 'PhamePostFulltextEngine' => 'PhabricatorFulltextEngine', 'PhamePostHistoryController' => 'PhamePostController', 'PhamePostListController' => 'PhamePostController', 'PhamePostListView' => 'AphrontTagView', diff --git a/src/applications/phame/phid/PhabricatorPhamePostPHIDType.php b/src/applications/phame/phid/PhabricatorPhamePostPHIDType.php index 5573f2db9f..4250c91949 100644 --- a/src/applications/phame/phid/PhabricatorPhamePostPHIDType.php +++ b/src/applications/phame/phid/PhabricatorPhamePostPHIDType.php @@ -34,7 +34,13 @@ final class PhabricatorPhamePostPHIDType extends PhabricatorPHIDType { $handle->setName($post->getTitle()); $handle->setFullName($post->getTitle()); $handle->setURI('/phame/post/view/'.$post->getID().'/'); + + if ($post->isArchived()) { + $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); + } + } + } } diff --git a/src/applications/phame/search/PhamePostFulltextEngine.php b/src/applications/phame/search/PhamePostFulltextEngine.php new file mode 100644 index 0000000000..27a97ae4ba --- /dev/null +++ b/src/applications/phame/search/PhamePostFulltextEngine.php @@ -0,0 +1,34 @@ +setDocumentTitle($post->getTitle()); + + $document->addField( + PhabricatorSearchDocumentFieldType::FIELD_BODY, + $post->getBody()); + + $document->addRelationship( + PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, + $post->getBloggerPHID(), + PhabricatorPeopleUserPHIDType::TYPECONST, + $post->getDateCreated()); + + $document->addRelationship( + $post->isArchived() + ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED + : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, + $post->getPHID(), + PhabricatorPhamePostPHIDType::TYPECONST, + PhabricatorTime::getNow()); + + } + +} diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php index f77032ffab..2d8fc887c5 100644 --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -10,7 +10,8 @@ final class PhamePost extends PhameDAO PhabricatorSubscribableInterface, PhabricatorDestructibleInterface, PhabricatorTokenReceiverInterface, - PhabricatorConduitResultInterface { + PhabricatorConduitResultInterface, + PhabricatorFulltextInterface { const MARKUP_FIELD_BODY = 'markup:body'; const MARKUP_FIELD_SUMMARY = 'markup:summary'; @@ -344,4 +345,11 @@ final class PhamePost extends PhameDAO return array(); } + +/* -( PhabricatorFulltextInterface )--------------------------------------- */ + + public function newFulltextEngine() { + return new PhamePostFulltextEngine(); + } + }