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 @@ -4849,6 +4849,7 @@ 'PhrictionContentQuery' => 'applications/phriction/query/PhrictionContentQuery.php', 'PhrictionContentSearchConduitAPIMethod' => 'applications/phriction/conduit/PhrictionContentSearchConduitAPIMethod.php', 'PhrictionContentSearchEngine' => 'applications/phriction/query/PhrictionContentSearchEngine.php', + 'PhrictionContentSearchEngineAttachment' => 'applications/phriction/engineextension/PhrictionContentSearchEngineAttachment.php', 'PhrictionController' => 'applications/phriction/controller/PhrictionController.php', 'PhrictionCreateConduitAPIMethod' => 'applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php', 'PhrictionDAO' => 'applications/phriction/storage/PhrictionDAO.php', @@ -10768,6 +10769,7 @@ 'PhrictionContentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhrictionContentSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 'PhrictionContentSearchEngine' => 'PhabricatorApplicationSearchEngine', + 'PhrictionContentSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment', 'PhrictionController' => 'PhabricatorController', 'PhrictionCreateConduitAPIMethod' => 'PhrictionConduitAPIMethod', 'PhrictionDAO' => 'PhabricatorLiskDAO', @@ -10784,6 +10786,7 @@ 'PhabricatorFerretInterface', 'PhabricatorProjectInterface', 'PhabricatorApplicationTransactionInterface', + 'PhabricatorConduitResultInterface', ), 'PhrictionDocumentAuthorHeraldField' => 'PhrictionDocumentHeraldField', 'PhrictionDocumentContentHeraldField' => 'PhrictionDocumentHeraldField', diff --git a/src/applications/phriction/engineextension/PhrictionContentSearchEngineAttachment.php b/src/applications/phriction/engineextension/PhrictionContentSearchEngineAttachment.php new file mode 100644 --- /dev/null +++ b/src/applications/phriction/engineextension/PhrictionContentSearchEngineAttachment.php @@ -0,0 +1,31 @@ +getContent(); + } else { + $content = $object; + } + + return array( + 'title' => $content->getTitle(), + 'path' => $content->getSlug(), + 'authorPHID' => $content->getAuthorPHID(), + 'content' => array( + 'raw' => $content->getContent(), + ), + ); + } + +} diff --git a/src/applications/phriction/storage/PhrictionContent.php b/src/applications/phriction/storage/PhrictionContent.php --- a/src/applications/phriction/storage/PhrictionContent.php +++ b/src/applications/phriction/storage/PhrictionContent.php @@ -118,10 +118,6 @@ ->setKey('version') ->setType('int') ->setDescription(pht('Content version.')), - id(new PhabricatorConduitSearchFieldSpecification()) - ->setKey('authorPHID') - ->setType('phid') - ->setDescription(pht('Author of this version of the content.')), ); } @@ -129,12 +125,14 @@ return array( 'documentPHID' => $this->getDocument()->getPHID(), 'version' => (int)$this->getVersion(), - 'authorPHID' => $this->getAuthorPHID(), ); } public function getConduitSearchAttachments() { - return array(); + return array( + id(new PhrictionContentSearchEngineAttachment()) + ->setAttachmentKey('content'), + ); } } diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php --- a/src/applications/phriction/storage/PhrictionDocument.php +++ b/src/applications/phriction/storage/PhrictionDocument.php @@ -10,7 +10,8 @@ PhabricatorFulltextInterface, PhabricatorFerretInterface, PhabricatorProjectInterface, - PhabricatorApplicationTransactionInterface { + PhabricatorApplicationTransactionInterface, + PhabricatorConduitResultInterface { protected $slug; protected $depth; @@ -288,4 +289,39 @@ return new PhrictionDocumentFerretEngine(); } + +/* -( PhabricatorConduitResultInterface )---------------------------------- */ + + + public function getFieldSpecificationsForConduit() { + return array( + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('path') + ->setType('string') + ->setDescription(pht('The path to the document.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('status') + ->setType('map') + ->setDescription(pht('Status information about the document.')), + ); + } + + public function getFieldValuesForConduit() { + $status = array( + 'value' => $this->getStatus(), + 'name' => $this->getStatusDisplayName(), + ); + + return array( + 'path' => $this->getSlug(), + 'status' => $status, + ); + } + + public function getConduitSearchAttachments() { + return array( + id(new PhrictionContentSearchEngineAttachment()) + ->setAttachmentKey('content'), + ); + } }