@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

Support Ferret engine in Fund initiatives

Summary: Ref T12819. Adds Ferret engine support to initiatives.

Test Plan: Indexed and searched for initiatives.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12819

Differential Revision: https://secure.phabricator.com/D18555

+113 -5
+9
resources/sql/autopatches/20170907.ferret.04.fund.doc.sql
··· 1 + CREATE TABLE {$NAMESPACE}_fund.fund_initiative_fdocument ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + objectPHID VARBINARY(64) NOT NULL, 4 + isClosed BOOL NOT NULL, 5 + authorPHID VARBINARY(64), 6 + ownerPHID VARBINARY(64), 7 + epochCreated INT UNSIGNED NOT NULL, 8 + epochModified INT UNSIGNED NOT NULL 9 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+8
resources/sql/autopatches/20170907.ferret.05.fund.field.sql
··· 1 + CREATE TABLE {$NAMESPACE}_fund.fund_initiative_ffield ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + documentID INT UNSIGNED NOT NULL, 4 + fieldKey VARCHAR(4) NOT NULL COLLATE {$COLLATE_TEXT}, 5 + rawCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}, 6 + termCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}, 7 + normalCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT} 8 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+5
resources/sql/autopatches/20170907.ferret.06.fund.ngrams.sql
··· 1 + CREATE TABLE {$NAMESPACE}_fund.fund_initiative_fngrams ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + documentID INT UNSIGNED NOT NULL, 4 + ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT} 5 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+9
src/__phutil_library_map__.php
··· 1153 1153 'FundInitiativeEditController' => 'applications/fund/controller/FundInitiativeEditController.php', 1154 1154 'FundInitiativeEditEngine' => 'applications/fund/editor/FundInitiativeEditEngine.php', 1155 1155 'FundInitiativeEditor' => 'applications/fund/editor/FundInitiativeEditor.php', 1156 + 'FundInitiativeFerretDocument' => 'applications/fund/storage/FundInitiativeFerretDocument.php', 1157 + 'FundInitiativeFerretEngine' => 'applications/fund/search/FundInitiativeFerretEngine.php', 1158 + 'FundInitiativeFerretField' => 'applications/fund/storage/FundInitiativeFerretField.php', 1159 + 'FundInitiativeFerretNgrams' => 'applications/fund/storage/FundInitiativeFerretNgrams.php', 1156 1160 'FundInitiativeFulltextEngine' => 'applications/fund/search/FundInitiativeFulltextEngine.php', 1157 1161 'FundInitiativeListController' => 'applications/fund/controller/FundInitiativeListController.php', 1158 1162 'FundInitiativeMerchantTransaction' => 'applications/fund/xaction/FundInitiativeMerchantTransaction.php', ··· 6231 6235 'PhabricatorTokenReceiverInterface', 6232 6236 'PhabricatorDestructibleInterface', 6233 6237 'PhabricatorFulltextInterface', 6238 + 'PhabricatorFerretInterface', 6234 6239 ), 6235 6240 'FundInitiativeBackController' => 'FundController', 6236 6241 'FundInitiativeBackerTransaction' => 'FundInitiativeTransactionType', ··· 6239 6244 'FundInitiativeEditController' => 'FundController', 6240 6245 'FundInitiativeEditEngine' => 'PhabricatorEditEngine', 6241 6246 'FundInitiativeEditor' => 'PhabricatorApplicationTransactionEditor', 6247 + 'FundInitiativeFerretDocument' => 'PhabricatorFerretDocument', 6248 + 'FundInitiativeFerretEngine' => 'PhabricatorFerretEngine', 6249 + 'FundInitiativeFerretField' => 'PhabricatorFerretField', 6250 + 'FundInitiativeFerretNgrams' => 'PhabricatorFerretNgrams', 6242 6251 'FundInitiativeFulltextEngine' => 'PhabricatorFulltextEngine', 6243 6252 'FundInitiativeListController' => 'FundController', 6244 6253 'FundInitiativeMerchantTransaction' => 'FundInitiativeTransactionType',
+8 -4
src/applications/fund/query/FundInitiativeQuery.php
··· 42 42 if ($this->ids !== null) { 43 43 $where[] = qsprintf( 44 44 $conn, 45 - 'id IN (%Ld)', 45 + 'i.id IN (%Ld)', 46 46 $this->ids); 47 47 } 48 48 49 49 if ($this->phids !== null) { 50 50 $where[] = qsprintf( 51 51 $conn, 52 - 'phid IN (%Ls)', 52 + 'i.phid IN (%Ls)', 53 53 $this->phids); 54 54 } 55 55 56 56 if ($this->ownerPHIDs !== null) { 57 57 $where[] = qsprintf( 58 58 $conn, 59 - 'ownerPHID IN (%Ls)', 59 + 'i.ownerPHID IN (%Ls)', 60 60 $this->ownerPHIDs); 61 61 } 62 62 63 63 if ($this->statuses !== null) { 64 64 $where[] = qsprintf( 65 65 $conn, 66 - 'status IN (%Ls)', 66 + 'i.status IN (%Ls)', 67 67 $this->statuses); 68 68 } 69 69 ··· 72 72 73 73 public function getQueryApplicationClass() { 74 74 return 'PhabricatorFundApplication'; 75 + } 76 + 77 + protected function getPrimaryTableAlias() { 78 + return 'i'; 75 79 } 76 80 77 81 }
+22
src/applications/fund/search/FundInitiativeFerretEngine.php
··· 1 + <?php 2 + 3 + final class FundInitiativeFerretEngine 4 + extends PhabricatorFerretEngine { 5 + 6 + public function newNgramsObject() { 7 + return new FundInitiativeFerretNgrams(); 8 + } 9 + 10 + public function newDocumentObject() { 11 + return new FundInitiativeFerretDocument(); 12 + } 13 + 14 + public function newFieldObject() { 15 + return new FundInitiativeFerretField(); 16 + } 17 + 18 + public function newSearchEngine() { 19 + return new FundInitiativeSearchEngine(); 20 + } 21 + 22 + }
+10 -1
src/applications/fund/storage/FundInitiative.php
··· 10 10 PhabricatorFlaggableInterface, 11 11 PhabricatorTokenReceiverInterface, 12 12 PhabricatorDestructibleInterface, 13 - PhabricatorFulltextInterface { 13 + PhabricatorFulltextInterface, 14 + PhabricatorFerretInterface { 14 15 15 16 protected $name; 16 17 protected $ownerPHID; ··· 210 211 211 212 public function newFulltextEngine() { 212 213 return new FundInitiativeFulltextEngine(); 214 + } 215 + 216 + 217 + /* -( PhabricatorFerretInterface )----------------------------------------- */ 218 + 219 + 220 + public function newFerretEngine() { 221 + return new FundInitiativeFerretEngine(); 213 222 } 214 223 215 224 }
+14
src/applications/fund/storage/FundInitiativeFerretDocument.php
··· 1 + <?php 2 + 3 + final class FundInitiativeFerretDocument 4 + extends PhabricatorFerretDocument { 5 + 6 + public function getApplicationName() { 7 + return 'fund'; 8 + } 9 + 10 + public function getIndexKey() { 11 + return 'initiative'; 12 + } 13 + 14 + }
+14
src/applications/fund/storage/FundInitiativeFerretField.php
··· 1 + <?php 2 + 3 + final class FundInitiativeFerretField 4 + extends PhabricatorFerretField { 5 + 6 + public function getApplicationName() { 7 + return 'fund'; 8 + } 9 + 10 + public function getIndexKey() { 11 + return 'initiative'; 12 + } 13 + 14 + }
+14
src/applications/fund/storage/FundInitiativeFerretNgrams.php
··· 1 + <?php 2 + 3 + final class FundInitiativeFerretNgrams 4 + extends PhabricatorFerretNgrams { 5 + 6 + public function getApplicationName() { 7 + return 'fund'; 8 + } 9 + 10 + public function getIndexKey() { 11 + return 'initiative'; 12 + } 13 + 14 + }