mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Add PhamePost to full text search
Summary: Adds PhamePost object to fulltextsearch index. Some issue searching just "Open" though? Also "closed" objects search fine but don't display as disabled. Test Plan: bin/search index --type POST {F1687043} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T9897 Differential Revision: https://secure.phabricator.com/D16116
This commit is contained in:
parent
e44d92babc
commit
bce44c8b02
4 changed files with 52 additions and 1 deletions
|
@ -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',
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
34
src/applications/phame/search/PhamePostFulltextEngine.php
Normal file
34
src/applications/phame/search/PhamePostFulltextEngine.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
final class PhamePostFulltextEngine
|
||||
extends PhabricatorFulltextEngine {
|
||||
|
||||
protected function buildAbstractDocument(
|
||||
PhabricatorSearchAbstractDocument $document,
|
||||
$object) {
|
||||
|
||||
$post = $object;
|
||||
|
||||
$document->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());
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue