Page MenuHomePhabricator

D18559.diff
No OneTemporary

D18559.diff

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
@@ -532,10 +532,7 @@
'DifferentialRevisionEditConduitAPIMethod' => 'applications/differential/conduit/DifferentialRevisionEditConduitAPIMethod.php',
'DifferentialRevisionEditController' => 'applications/differential/controller/DifferentialRevisionEditController.php',
'DifferentialRevisionEditEngine' => 'applications/differential/editor/DifferentialRevisionEditEngine.php',
- 'DifferentialRevisionFerretDocument' => 'applications/differential/storage/DifferentialRevisionFerretDocument.php',
'DifferentialRevisionFerretEngine' => 'applications/differential/search/DifferentialRevisionFerretEngine.php',
- 'DifferentialRevisionFerretField' => 'applications/differential/storage/DifferentialRevisionFerretField.php',
- 'DifferentialRevisionFerretNgrams' => 'applications/differential/storage/DifferentialRevisionFerretNgrams.php',
'DifferentialRevisionFulltextEngine' => 'applications/differential/search/DifferentialRevisionFulltextEngine.php',
'DifferentialRevisionGraph' => 'infrastructure/graph/DifferentialRevisionGraph.php',
'DifferentialRevisionHasChildRelationship' => 'applications/differential/relationships/DifferentialRevisionHasChildRelationship.php',
@@ -1153,10 +1150,7 @@
'FundInitiativeEditController' => 'applications/fund/controller/FundInitiativeEditController.php',
'FundInitiativeEditEngine' => 'applications/fund/editor/FundInitiativeEditEngine.php',
'FundInitiativeEditor' => 'applications/fund/editor/FundInitiativeEditor.php',
- 'FundInitiativeFerretDocument' => 'applications/fund/storage/FundInitiativeFerretDocument.php',
'FundInitiativeFerretEngine' => 'applications/fund/search/FundInitiativeFerretEngine.php',
- 'FundInitiativeFerretField' => 'applications/fund/storage/FundInitiativeFerretField.php',
- 'FundInitiativeFerretNgrams' => 'applications/fund/storage/FundInitiativeFerretNgrams.php',
'FundInitiativeFulltextEngine' => 'applications/fund/search/FundInitiativeFulltextEngine.php',
'FundInitiativeListController' => 'applications/fund/controller/FundInitiativeListController.php',
'FundInitiativeMerchantTransaction' => 'applications/fund/xaction/FundInitiativeMerchantTransaction.php',
@@ -1539,10 +1533,7 @@
'ManiphestTaskEditBulkJobType' => 'applications/maniphest/bulk/ManiphestTaskEditBulkJobType.php',
'ManiphestTaskEditController' => 'applications/maniphest/controller/ManiphestTaskEditController.php',
'ManiphestTaskEditEngineLock' => 'applications/maniphest/editor/ManiphestTaskEditEngineLock.php',
- 'ManiphestTaskFerretDocument' => 'applications/maniphest/storage/ManiphestTaskFerretDocument.php',
'ManiphestTaskFerretEngine' => 'applications/maniphest/search/ManiphestTaskFerretEngine.php',
- 'ManiphestTaskFerretField' => 'applications/maniphest/storage/ManiphestTaskFerretField.php',
- 'ManiphestTaskFerretNgrams' => 'applications/maniphest/storage/ManiphestTaskFerretNgrams.php',
'ManiphestTaskFulltextEngine' => 'applications/maniphest/search/ManiphestTaskFulltextEngine.php',
'ManiphestTaskGraph' => 'infrastructure/graph/ManiphestTaskGraph.php',
'ManiphestTaskHasCommitEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasCommitEdgeType.php',
@@ -1840,10 +1831,7 @@
'PassphraseCredentialDestroyController' => 'applications/passphrase/controller/PassphraseCredentialDestroyController.php',
'PassphraseCredentialDestroyTransaction' => 'applications/passphrase/xaction/PassphraseCredentialDestroyTransaction.php',
'PassphraseCredentialEditController' => 'applications/passphrase/controller/PassphraseCredentialEditController.php',
- 'PassphraseCredentialFerretDocument' => 'applications/passphrase/storage/PassphraseCredentialFerretDocument.php',
'PassphraseCredentialFerretEngine' => 'applications/passphrase/search/PassphraseCredentialFerretEngine.php',
- 'PassphraseCredentialFerretField' => 'applications/passphrase/storage/PassphraseCredentialFerretField.php',
- 'PassphraseCredentialFerretNgrams' => 'applications/passphrase/storage/PassphraseCredentialFerretNgrams.php',
'PassphraseCredentialFulltextEngine' => 'applications/passphrase/search/PassphraseCredentialFulltextEngine.php',
'PassphraseCredentialListController' => 'applications/passphrase/controller/PassphraseCredentialListController.php',
'PassphraseCredentialLockController' => 'applications/passphrase/controller/PassphraseCredentialLockController.php',
@@ -2841,15 +2829,12 @@
'PhabricatorFeedStoryNotification' => 'applications/notification/storage/PhabricatorFeedStoryNotification.php',
'PhabricatorFeedStoryPublisher' => 'applications/feed/PhabricatorFeedStoryPublisher.php',
'PhabricatorFeedStoryReference' => 'applications/feed/storage/PhabricatorFeedStoryReference.php',
- 'PhabricatorFerretDocument' => 'applications/search/ferret/PhabricatorFerretDocument.php',
'PhabricatorFerretEngine' => 'applications/search/ferret/PhabricatorFerretEngine.php',
'PhabricatorFerretEngineTestCase' => 'applications/search/ferret/__tests__/PhabricatorFerretEngineTestCase.php',
- 'PhabricatorFerretField' => 'applications/search/ferret/PhabricatorFerretField.php',
'PhabricatorFerretFulltextEngineExtension' => 'applications/search/engineextension/PhabricatorFerretFulltextEngineExtension.php',
'PhabricatorFerretFulltextStorageEngine' => 'applications/search/fulltextstorage/PhabricatorFerretFulltextStorageEngine.php',
'PhabricatorFerretInterface' => 'applications/search/ferret/PhabricatorFerretInterface.php',
'PhabricatorFerretMetadata' => 'applications/search/ferret/PhabricatorFerretMetadata.php',
- 'PhabricatorFerretNgrams' => 'applications/search/ferret/PhabricatorFerretNgrams.php',
'PhabricatorFerretSearchEngineExtension' => 'applications/search/engineextension/PhabricatorFerretSearchEngineExtension.php',
'PhabricatorFile' => 'applications/files/storage/PhabricatorFile.php',
'PhabricatorFileAES256StorageFormat' => 'applications/files/format/PhabricatorFileAES256StorageFormat.php',
@@ -4265,10 +4250,7 @@
'PhabricatorUserEditorTestCase' => 'applications/people/editor/__tests__/PhabricatorUserEditorTestCase.php',
'PhabricatorUserEmail' => 'applications/people/storage/PhabricatorUserEmail.php',
'PhabricatorUserEmailTestCase' => 'applications/people/storage/__tests__/PhabricatorUserEmailTestCase.php',
- 'PhabricatorUserFerretDocument' => 'applications/people/storage/PhabricatorUserFerretDocument.php',
'PhabricatorUserFerretEngine' => 'applications/people/search/PhabricatorUserFerretEngine.php',
- 'PhabricatorUserFerretField' => 'applications/people/storage/PhabricatorUserFerretField.php',
- 'PhabricatorUserFerretNgrams' => 'applications/people/storage/PhabricatorUserFerretNgrams.php',
'PhabricatorUserFulltextEngine' => 'applications/people/search/PhabricatorUserFulltextEngine.php',
'PhabricatorUserIconField' => 'applications/people/customfield/PhabricatorUserIconField.php',
'PhabricatorUserLog' => 'applications/people/storage/PhabricatorUserLog.php',
@@ -5564,10 +5546,7 @@
'DifferentialRevisionEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
'DifferentialRevisionEditController' => 'DifferentialController',
'DifferentialRevisionEditEngine' => 'PhabricatorEditEngine',
- 'DifferentialRevisionFerretDocument' => 'PhabricatorFerretDocument',
'DifferentialRevisionFerretEngine' => 'PhabricatorFerretEngine',
- 'DifferentialRevisionFerretField' => 'PhabricatorFerretField',
- 'DifferentialRevisionFerretNgrams' => 'PhabricatorFerretNgrams',
'DifferentialRevisionFulltextEngine' => 'PhabricatorFulltextEngine',
'DifferentialRevisionGraph' => 'PhabricatorObjectGraph',
'DifferentialRevisionHasChildRelationship' => 'DifferentialRevisionRelationship',
@@ -6248,10 +6227,7 @@
'FundInitiativeEditController' => 'FundController',
'FundInitiativeEditEngine' => 'PhabricatorEditEngine',
'FundInitiativeEditor' => 'PhabricatorApplicationTransactionEditor',
- 'FundInitiativeFerretDocument' => 'PhabricatorFerretDocument',
'FundInitiativeFerretEngine' => 'PhabricatorFerretEngine',
- 'FundInitiativeFerretField' => 'PhabricatorFerretField',
- 'FundInitiativeFerretNgrams' => 'PhabricatorFerretNgrams',
'FundInitiativeFulltextEngine' => 'PhabricatorFulltextEngine',
'FundInitiativeListController' => 'FundController',
'FundInitiativeMerchantTransaction' => 'FundInitiativeTransactionType',
@@ -6719,10 +6695,7 @@
'ManiphestTaskEditBulkJobType' => 'PhabricatorWorkerBulkJobType',
'ManiphestTaskEditController' => 'ManiphestController',
'ManiphestTaskEditEngineLock' => 'PhabricatorEditEngineLock',
- 'ManiphestTaskFerretDocument' => 'PhabricatorFerretDocument',
'ManiphestTaskFerretEngine' => 'PhabricatorFerretEngine',
- 'ManiphestTaskFerretField' => 'PhabricatorFerretField',
- 'ManiphestTaskFerretNgrams' => 'PhabricatorFerretNgrams',
'ManiphestTaskFulltextEngine' => 'PhabricatorFulltextEngine',
'ManiphestTaskGraph' => 'PhabricatorObjectGraph',
'ManiphestTaskHasCommitEdgeType' => 'PhabricatorEdgeType',
@@ -7049,10 +7022,7 @@
'PassphraseCredentialDestroyController' => 'PassphraseController',
'PassphraseCredentialDestroyTransaction' => 'PassphraseCredentialTransactionType',
'PassphraseCredentialEditController' => 'PassphraseController',
- 'PassphraseCredentialFerretDocument' => 'PhabricatorFerretDocument',
'PassphraseCredentialFerretEngine' => 'PhabricatorFerretEngine',
- 'PassphraseCredentialFerretField' => 'PhabricatorFerretField',
- 'PassphraseCredentialFerretNgrams' => 'PhabricatorFerretNgrams',
'PassphraseCredentialFulltextEngine' => 'PhabricatorFulltextEngine',
'PassphraseCredentialListController' => 'PassphraseController',
'PassphraseCredentialLockController' => 'PassphraseController',
@@ -8192,14 +8162,11 @@
'PhabricatorFeedStoryNotification' => 'PhabricatorFeedDAO',
'PhabricatorFeedStoryPublisher' => 'Phobject',
'PhabricatorFeedStoryReference' => 'PhabricatorFeedDAO',
- 'PhabricatorFerretDocument' => 'PhabricatorSearchDAO',
'PhabricatorFerretEngine' => 'Phobject',
'PhabricatorFerretEngineTestCase' => 'PhabricatorTestCase',
- 'PhabricatorFerretField' => 'PhabricatorSearchDAO',
'PhabricatorFerretFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension',
'PhabricatorFerretFulltextStorageEngine' => 'PhabricatorFulltextStorageEngine',
'PhabricatorFerretMetadata' => 'Phobject',
- 'PhabricatorFerretNgrams' => 'PhabricatorSearchDAO',
'PhabricatorFerretSearchEngineExtension' => 'PhabricatorSearchEngineExtension',
'PhabricatorFile' => array(
'PhabricatorFileDAO',
@@ -9885,10 +9852,7 @@
'PhabricatorUserEditorTestCase' => 'PhabricatorTestCase',
'PhabricatorUserEmail' => 'PhabricatorUserDAO',
'PhabricatorUserEmailTestCase' => 'PhabricatorTestCase',
- 'PhabricatorUserFerretDocument' => 'PhabricatorFerretDocument',
'PhabricatorUserFerretEngine' => 'PhabricatorFerretEngine',
- 'PhabricatorUserFerretField' => 'PhabricatorFerretField',
- 'PhabricatorUserFerretNgrams' => 'PhabricatorFerretNgrams',
'PhabricatorUserFulltextEngine' => 'PhabricatorFulltextEngine',
'PhabricatorUserIconField' => 'PhabricatorUserCustomField',
'PhabricatorUserLog' => array(
diff --git a/src/applications/config/schema/PhabricatorConfigCoreSchemaSpec.php b/src/applications/config/schema/PhabricatorConfigCoreSchemaSpec.php
--- a/src/applications/config/schema/PhabricatorConfigCoreSchemaSpec.php
+++ b/src/applications/config/schema/PhabricatorConfigCoreSchemaSpec.php
@@ -42,5 +42,13 @@
));
}
+ $ferret_objects = id(new PhutilClassMapQuery())
+ ->setAncestorClass('PhabricatorFerretInterface')
+ ->execute();
+
+ foreach ($ferret_objects as $ferret_object) {
+ $engine = $ferret_object->newFerretEngine();
+ $this->buildFerretIndexSchema($engine);
+ }
}
}
diff --git a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php
--- a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php
+++ b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php
@@ -55,6 +55,26 @@
$object->getSchemaKeys());
}
+ protected function buildFerretIndexSchema(PhabricatorFerretEngine $engine) {
+ $this->buildRawSchema(
+ $engine->getApplicationName(),
+ $engine->getDocumentTableName(),
+ $engine->getDocumentSchemaColumns(),
+ $engine->getDocumentSchemaKeys());
+
+ $this->buildRawSchema(
+ $engine->getApplicationName(),
+ $engine->getFieldTableName(),
+ $engine->getFieldSchemaColumns(),
+ $engine->getFieldSchemaKeys());
+
+ $this->buildRawSchema(
+ $engine->getApplicationName(),
+ $engine->getNgramsTableName(),
+ $engine->getNgramsSchemaColumns(),
+ $engine->getNgramsSchemaKeys());
+ }
+
protected function buildRawSchema(
$database_name,
$table_name,
diff --git a/src/applications/differential/search/DifferentialRevisionFerretEngine.php b/src/applications/differential/search/DifferentialRevisionFerretEngine.php
--- a/src/applications/differential/search/DifferentialRevisionFerretEngine.php
+++ b/src/applications/differential/search/DifferentialRevisionFerretEngine.php
@@ -3,16 +3,12 @@
final class DifferentialRevisionFerretEngine
extends PhabricatorFerretEngine {
- public function newNgramsObject() {
- return new DifferentialRevisionFerretNgrams();
+ public function getApplicationName() {
+ return 'differential';
}
- public function newDocumentObject() {
- return new DifferentialRevisionFerretDocument();
- }
-
- public function newFieldObject() {
- return new DifferentialRevisionFerretField();
+ public function getScopeName() {
+ return 'revision';
}
public function newSearchEngine() {
diff --git a/src/applications/differential/storage/DifferentialRevisionFerretDocument.php b/src/applications/differential/storage/DifferentialRevisionFerretDocument.php
deleted file mode 100644
--- a/src/applications/differential/storage/DifferentialRevisionFerretDocument.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class DifferentialRevisionFerretDocument
- extends PhabricatorFerretDocument {
-
- public function getApplicationName() {
- return 'differential';
- }
-
- public function getIndexKey() {
- return 'revision';
- }
-
-}
diff --git a/src/applications/differential/storage/DifferentialRevisionFerretField.php b/src/applications/differential/storage/DifferentialRevisionFerretField.php
deleted file mode 100644
--- a/src/applications/differential/storage/DifferentialRevisionFerretField.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class DifferentialRevisionFerretField
- extends PhabricatorFerretField {
-
- public function getApplicationName() {
- return 'differential';
- }
-
- public function getIndexKey() {
- return 'revision';
- }
-
-}
diff --git a/src/applications/differential/storage/DifferentialRevisionFerretNgrams.php b/src/applications/differential/storage/DifferentialRevisionFerretNgrams.php
deleted file mode 100644
--- a/src/applications/differential/storage/DifferentialRevisionFerretNgrams.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class DifferentialRevisionFerretNgrams
- extends PhabricatorFerretNgrams {
-
- public function getApplicationName() {
- return 'differential';
- }
-
- public function getIndexKey() {
- return 'revision';
- }
-
-}
diff --git a/src/applications/fund/search/FundInitiativeFerretEngine.php b/src/applications/fund/search/FundInitiativeFerretEngine.php
--- a/src/applications/fund/search/FundInitiativeFerretEngine.php
+++ b/src/applications/fund/search/FundInitiativeFerretEngine.php
@@ -3,16 +3,12 @@
final class FundInitiativeFerretEngine
extends PhabricatorFerretEngine {
- public function newNgramsObject() {
- return new FundInitiativeFerretNgrams();
+ public function getApplicationName() {
+ return 'fund';
}
- public function newDocumentObject() {
- return new FundInitiativeFerretDocument();
- }
-
- public function newFieldObject() {
- return new FundInitiativeFerretField();
+ public function getScopeName() {
+ return 'initiative';
}
public function newSearchEngine() {
diff --git a/src/applications/fund/storage/FundInitiativeFerretDocument.php b/src/applications/fund/storage/FundInitiativeFerretDocument.php
deleted file mode 100644
--- a/src/applications/fund/storage/FundInitiativeFerretDocument.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class FundInitiativeFerretDocument
- extends PhabricatorFerretDocument {
-
- public function getApplicationName() {
- return 'fund';
- }
-
- public function getIndexKey() {
- return 'initiative';
- }
-
-}
diff --git a/src/applications/fund/storage/FundInitiativeFerretField.php b/src/applications/fund/storage/FundInitiativeFerretField.php
deleted file mode 100644
--- a/src/applications/fund/storage/FundInitiativeFerretField.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class FundInitiativeFerretField
- extends PhabricatorFerretField {
-
- public function getApplicationName() {
- return 'fund';
- }
-
- public function getIndexKey() {
- return 'initiative';
- }
-
-}
diff --git a/src/applications/fund/storage/FundInitiativeFerretNgrams.php b/src/applications/fund/storage/FundInitiativeFerretNgrams.php
deleted file mode 100644
--- a/src/applications/fund/storage/FundInitiativeFerretNgrams.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class FundInitiativeFerretNgrams
- extends PhabricatorFerretNgrams {
-
- public function getApplicationName() {
- return 'fund';
- }
-
- public function getIndexKey() {
- return 'initiative';
- }
-
-}
diff --git a/src/applications/maniphest/search/ManiphestTaskFerretEngine.php b/src/applications/maniphest/search/ManiphestTaskFerretEngine.php
--- a/src/applications/maniphest/search/ManiphestTaskFerretEngine.php
+++ b/src/applications/maniphest/search/ManiphestTaskFerretEngine.php
@@ -3,16 +3,12 @@
final class ManiphestTaskFerretEngine
extends PhabricatorFerretEngine {
- public function newNgramsObject() {
- return new ManiphestTaskFerretNgrams();
+ public function getApplicationName() {
+ return 'maniphest';
}
- public function newDocumentObject() {
- return new ManiphestTaskFerretDocument();
- }
-
- public function newFieldObject() {
- return new ManiphestTaskFerretField();
+ public function getScopeName() {
+ return 'task';
}
public function newSearchEngine() {
diff --git a/src/applications/maniphest/storage/ManiphestTaskFerretDocument.php b/src/applications/maniphest/storage/ManiphestTaskFerretDocument.php
deleted file mode 100644
--- a/src/applications/maniphest/storage/ManiphestTaskFerretDocument.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class ManiphestTaskFerretDocument
- extends PhabricatorFerretDocument {
-
- public function getApplicationName() {
- return 'maniphest';
- }
-
- public function getIndexKey() {
- return 'task';
- }
-
-}
diff --git a/src/applications/maniphest/storage/ManiphestTaskFerretField.php b/src/applications/maniphest/storage/ManiphestTaskFerretField.php
deleted file mode 100644
--- a/src/applications/maniphest/storage/ManiphestTaskFerretField.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class ManiphestTaskFerretField
- extends PhabricatorFerretField {
-
- public function getApplicationName() {
- return 'maniphest';
- }
-
- public function getIndexKey() {
- return 'task';
- }
-
-}
diff --git a/src/applications/maniphest/storage/ManiphestTaskFerretNgrams.php b/src/applications/maniphest/storage/ManiphestTaskFerretNgrams.php
deleted file mode 100644
--- a/src/applications/maniphest/storage/ManiphestTaskFerretNgrams.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class ManiphestTaskFerretNgrams
- extends PhabricatorFerretNgrams {
-
- public function getApplicationName() {
- return 'maniphest';
- }
-
- public function getIndexKey() {
- return 'task';
- }
-
-}
diff --git a/src/applications/passphrase/search/PassphraseCredentialFerretEngine.php b/src/applications/passphrase/search/PassphraseCredentialFerretEngine.php
--- a/src/applications/passphrase/search/PassphraseCredentialFerretEngine.php
+++ b/src/applications/passphrase/search/PassphraseCredentialFerretEngine.php
@@ -3,16 +3,12 @@
final class PassphraseCredentialFerretEngine
extends PhabricatorFerretEngine {
- public function newNgramsObject() {
- return new PassphraseCredentialFerretNgrams();
+ public function getApplicationName() {
+ return 'passphrase';
}
- public function newDocumentObject() {
- return new PassphraseCredentialFerretDocument();
- }
-
- public function newFieldObject() {
- return new PassphraseCredentialFerretField();
+ public function getScopeName() {
+ return 'credential';
}
public function newSearchEngine() {
diff --git a/src/applications/passphrase/storage/PassphraseCredentialFerretDocument.php b/src/applications/passphrase/storage/PassphraseCredentialFerretDocument.php
deleted file mode 100644
--- a/src/applications/passphrase/storage/PassphraseCredentialFerretDocument.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class PassphraseCredentialFerretDocument
- extends PhabricatorFerretDocument {
-
- public function getApplicationName() {
- return 'passphrase';
- }
-
- public function getIndexKey() {
- return 'credential';
- }
-
-}
diff --git a/src/applications/passphrase/storage/PassphraseCredentialFerretField.php b/src/applications/passphrase/storage/PassphraseCredentialFerretField.php
deleted file mode 100644
--- a/src/applications/passphrase/storage/PassphraseCredentialFerretField.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class PassphraseCredentialFerretField
- extends PhabricatorFerretField {
-
- public function getApplicationName() {
- return 'passphrase';
- }
-
- public function getIndexKey() {
- return 'credential';
- }
-
-}
diff --git a/src/applications/passphrase/storage/PassphraseCredentialFerretNgrams.php b/src/applications/passphrase/storage/PassphraseCredentialFerretNgrams.php
deleted file mode 100644
--- a/src/applications/passphrase/storage/PassphraseCredentialFerretNgrams.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class PassphraseCredentialFerretNgrams
- extends PhabricatorFerretNgrams {
-
- public function getApplicationName() {
- return 'passphrase';
- }
-
- public function getIndexKey() {
- return 'credential';
- }
-
-}
diff --git a/src/applications/people/search/PhabricatorUserFerretEngine.php b/src/applications/people/search/PhabricatorUserFerretEngine.php
--- a/src/applications/people/search/PhabricatorUserFerretEngine.php
+++ b/src/applications/people/search/PhabricatorUserFerretEngine.php
@@ -3,16 +3,12 @@
final class PhabricatorUserFerretEngine
extends PhabricatorFerretEngine {
- public function newNgramsObject() {
- return new PhabricatorUserFerretNgrams();
+ public function getApplicationName() {
+ return 'user';
}
- public function newDocumentObject() {
- return new PhabricatorUserFerretDocument();
- }
-
- public function newFieldObject() {
- return new PhabricatorUserFerretField();
+ public function getScopeName() {
+ return 'user';
}
public function newSearchEngine() {
diff --git a/src/applications/people/storage/PhabricatorUserFerretDocument.php b/src/applications/people/storage/PhabricatorUserFerretDocument.php
deleted file mode 100644
--- a/src/applications/people/storage/PhabricatorUserFerretDocument.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class PhabricatorUserFerretDocument
- extends PhabricatorFerretDocument {
-
- public function getApplicationName() {
- return 'user';
- }
-
- public function getIndexKey() {
- return 'user';
- }
-
-}
diff --git a/src/applications/people/storage/PhabricatorUserFerretField.php b/src/applications/people/storage/PhabricatorUserFerretField.php
deleted file mode 100644
--- a/src/applications/people/storage/PhabricatorUserFerretField.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class PhabricatorUserFerretField
- extends PhabricatorFerretField {
-
- public function getApplicationName() {
- return 'user';
- }
-
- public function getIndexKey() {
- return 'user';
- }
-
-}
diff --git a/src/applications/people/storage/PhabricatorUserFerretNgrams.php b/src/applications/people/storage/PhabricatorUserFerretNgrams.php
deleted file mode 100644
--- a/src/applications/people/storage/PhabricatorUserFerretNgrams.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-final class PhabricatorUserFerretNgrams
- extends PhabricatorFerretNgrams {
-
- public function getApplicationName() {
- return 'user';
- }
-
- public function getIndexKey() {
- return 'user';
- }
-
-}
diff --git a/src/applications/search/engineextension/PhabricatorFerretFulltextEngineExtension.php b/src/applications/search/engineextension/PhabricatorFerretFulltextEngineExtension.php
--- a/src/applications/search/engineextension/PhabricatorFerretFulltextEngineExtension.php
+++ b/src/applications/search/engineextension/PhabricatorFerretFulltextEngineExtension.php
@@ -47,14 +47,6 @@
}
}
- $ferret_document = $engine->newDocumentObject()
- ->setObjectPHID($phid)
- ->setIsClosed($is_closed)
- ->setEpochCreated($document->getDocumentCreated())
- ->setEpochModified($document->getDocumentModified())
- ->setAuthorPHID($author_phid)
- ->setOwnerPHID($owner_phid);
-
$stemmer = $engine->newStemmer();
// Copy all of the "title" and "body" fields to create new "core" fields.
@@ -133,33 +125,49 @@
$ngrams_source[] = $term_corpus;
}
- $ferret_fields[] = $engine->newFieldObject()
- ->setFieldKey($key)
- ->setRawCorpus($raw_corpus)
- ->setTermCorpus($term_corpus)
- ->setNormalCorpus($normal_corpus);
+ $ferret_fields[] = array(
+ 'fieldKey' => $key,
+ 'rawCorpus' => $raw_corpus,
+ 'termCorpus' => $term_corpus,
+ 'normalCorpus' => $normal_corpus,
+ );
}
$ngrams_source = implode("\n", $ngrams_source);
$ngrams = $engine->getTermNgramsFromString($ngrams_source);
- $ferret_document->openTransaction();
+ $object->openTransaction();
try {
+ $conn = $object->establishConnection('w');
$this->deleteOldDocument($engine, $object, $document);
- $ferret_document->save();
-
- $document_id = $ferret_document->getID();
+ queryfx(
+ $conn,
+ 'INSERT INTO %T (objectPHID, isClosed, epochCreated, epochModified,
+ authorPHID, ownerPHID) VALUES (%s, %d, %d, %d, %ns, %ns)',
+ $engine->getDocumentTableName(),
+ $object->getPHID(),
+ $is_closed,
+ $document->getDocumentCreated(),
+ $document->getDocumentModified(),
+ $author_phid,
+ $owner_phid);
+
+ $document_id = $conn->getInsertID();
foreach ($ferret_fields as $ferret_field) {
- $ferret_field
- ->setDocumentID($document_id)
- ->save();
+ queryfx(
+ $conn,
+ 'INSERT INTO %T (documentID, fieldKey, rawCorpus, termCorpus,
+ normalCorpus) VALUES (%d, %s, %s, %s, %s)',
+ $engine->getFieldTableName(),
+ $document_id,
+ $ferret_field['fieldKey'],
+ $ferret_field['rawCorpus'],
+ $ferret_field['termCorpus'],
+ $ferret_field['normalCorpus']);
}
- $ferret_ngrams = $engine->newNgramsObject();
- $conn = $ferret_ngrams->establishConnection('w');
-
$sql = array();
foreach ($ngrams as $ngram) {
$sql[] = qsprintf(
@@ -173,15 +181,15 @@
queryfx(
$conn,
'INSERT INTO %T (documentID, ngram) VALUES %Q',
- $ferret_ngrams->getTableName(),
+ $engine->getNgramsTableName(),
$chunk);
}
} catch (Exception $ex) {
- $ferret_document->killTransaction();
+ $object->killTransaction();
throw $ex;
}
- $ferret_document->saveTransaction();
+ $object->saveTransaction();
}
@@ -190,32 +198,35 @@
$object,
PhabricatorSearchAbstractDocument $document) {
- $old_document = $engine->newDocumentObject()->loadOneWhere(
- 'objectPHID = %s',
- $document->getPHID());
+ $conn = $object->establishConnection('w');
+
+ $old_document = queryfx_one(
+ $conn,
+ 'SELECT * FROM %T WHERE objectPHID = %s',
+ $engine->getDocumentTableName(),
+ $object->getPHID());
if (!$old_document) {
return;
}
- $conn = $old_document->establishConnection('w');
- $old_id = $old_document->getID();
+ $old_id = $old_document['id'];
queryfx(
$conn,
'DELETE FROM %T WHERE id = %d',
- $engine->newDocumentObject()->getTableName(),
+ $engine->getDocumentTableName(),
$old_id);
queryfx(
$conn,
'DELETE FROM %T WHERE documentID = %d',
- $engine->newFieldObject()->getTableName(),
+ $engine->getFieldTableName(),
$old_id);
queryfx(
$conn,
'DELETE FROM %T WHERE documentID = %d',
- $engine->newNgramsObject()->getTableName(),
+ $engine->getNgramsTableName(),
$old_id);
}
diff --git a/src/applications/search/ferret/PhabricatorFerretDocument.php b/src/applications/search/ferret/PhabricatorFerretDocument.php
deleted file mode 100644
--- a/src/applications/search/ferret/PhabricatorFerretDocument.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-
-abstract class PhabricatorFerretDocument
- extends PhabricatorSearchDAO {
-
- protected $objectPHID;
- protected $isClosed;
- protected $authorPHID;
- protected $ownerPHID;
- protected $epochCreated;
- protected $epochModified;
-
- abstract public function getIndexKey();
-
- protected function getConfiguration() {
- return array(
- self::CONFIG_TIMESTAMPS => false,
- self::CONFIG_COLUMN_SCHEMA => array(
- 'isClosed' => 'bool',
- 'authorPHID' => 'phid?',
- 'ownerPHID' => 'phid?',
- 'epochCreated' => 'epoch',
- 'epochModified' => 'epoch',
- ),
- self::CONFIG_KEY_SCHEMA => array(
- 'key_object' => array(
- 'columns' => array('objectPHID'),
- 'unique' => true,
- ),
- 'key_author' => array(
- 'columns' => array('authorPHID'),
- ),
- 'key_owner' => array(
- 'columns' => array('ownerPHID'),
- ),
- 'key_created' => array(
- 'columns' => array('epochCreated'),
- ),
- 'key_modified' => array(
- 'columns' => array('epochModified'),
- ),
- ),
- ) + parent::getConfiguration();
- }
-
- public function getTableName() {
- $application = $this->getApplicationName();
- $key = $this->getIndexKey();
- return "{$application}_{$key}_fdocument";
- }
-
-}
diff --git a/src/applications/search/ferret/PhabricatorFerretEngine.php b/src/applications/search/ferret/PhabricatorFerretEngine.php
--- a/src/applications/search/ferret/PhabricatorFerretEngine.php
+++ b/src/applications/search/ferret/PhabricatorFerretEngine.php
@@ -2,9 +2,8 @@
abstract class PhabricatorFerretEngine extends Phobject {
- abstract public function newNgramsObject();
- abstract public function newDocumentObject();
- abstract public function newFieldObject();
+ abstract public function getApplicationName();
+ abstract public function getScopeName();
abstract public function newSearchEngine();
public function getDefaultFunctionKey() {
@@ -168,4 +167,111 @@
return $term_corpus;
}
+/* -( Schema )------------------------------------------------------------- */
+
+ public function getDocumentTableName() {
+ $application = $this->getApplicationName();
+ $scope = $this->getScopeName();
+
+ return "{$application}_{$scope}_fdocument";
+ }
+
+ public function getDocumentSchemaColumns() {
+ return array(
+ 'id' => 'auto',
+ 'objectPHID' => 'phid',
+ 'isClosed' => 'bool',
+ 'authorPHID' => 'phid?',
+ 'ownerPHID' => 'phid?',
+ 'epochCreated' => 'epoch',
+ 'epochModified' => 'epoch',
+ );
+ }
+
+ public function getDocumentSchemaKeys() {
+ return array(
+ 'PRIMARY' => array(
+ 'columns' => array('id'),
+ 'unique' => true,
+ ),
+ 'key_object' => array(
+ 'columns' => array('objectPHID'),
+ 'unique' => true,
+ ),
+ 'key_author' => array(
+ 'columns' => array('authorPHID'),
+ ),
+ 'key_owner' => array(
+ 'columns' => array('ownerPHID'),
+ ),
+ 'key_created' => array(
+ 'columns' => array('epochCreated'),
+ ),
+ 'key_modified' => array(
+ 'columns' => array('epochModified'),
+ ),
+ );
+ }
+
+ public function getFieldTableName() {
+ $application = $this->getApplicationName();
+ $scope = $this->getScopeName();
+
+ return "{$application}_{$scope}_ffield";
+ }
+
+ public function getFieldSchemaColumns() {
+ return array(
+ 'id' => 'auto',
+ 'documentID' => 'uint32',
+ 'fieldKey' => 'text4',
+ 'rawCorpus' => 'sort',
+ 'termCorpus' => 'sort',
+ 'normalCorpus' => 'sort',
+ );
+ }
+
+ public function getFieldSchemaKeys() {
+ return array(
+ 'PRIMARY' => array(
+ 'columns' => array('id'),
+ 'unique' => true,
+ ),
+ 'key_documentfield' => array(
+ 'columns' => array('documentID', 'fieldKey'),
+ 'unique' => true,
+ ),
+ );
+ }
+
+ public function getNgramsTableName() {
+ $application = $this->getApplicationName();
+ $scope = $this->getScopeName();
+
+ return "{$application}_{$scope}_fngrams";
+ }
+
+ public function getNgramsSchemaColumns() {
+ return array(
+ 'id' => 'auto',
+ 'documentID' => 'uint32',
+ 'ngram' => 'char3',
+ );
+ }
+
+ public function getNgramsSchemaKeys() {
+ return array(
+ 'PRIMARY' => array(
+ 'columns' => array('id'),
+ 'unique' => true,
+ ),
+ 'key_ngram' => array(
+ 'columns' => array('ngram', 'documentID'),
+ ),
+ 'key_object' => array(
+ 'columns' => array('documentID'),
+ ),
+ );
+ }
+
}
diff --git a/src/applications/search/ferret/PhabricatorFerretField.php b/src/applications/search/ferret/PhabricatorFerretField.php
deleted file mode 100644
--- a/src/applications/search/ferret/PhabricatorFerretField.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-abstract class PhabricatorFerretField
- extends PhabricatorSearchDAO {
-
- protected $documentID;
- protected $fieldKey;
- protected $rawCorpus;
- protected $termCorpus;
- protected $normalCorpus;
-
- abstract public function getIndexKey();
-
- protected function getConfiguration() {
- return array(
- self::CONFIG_TIMESTAMPS => false,
- self::CONFIG_COLUMN_SCHEMA => array(
- 'documentID' => 'uint32',
- 'fieldKey' => 'text4',
- 'rawCorpus' => 'sort',
- 'termCorpus' => 'sort',
- 'normalCorpus' => 'sort',
- ),
- self::CONFIG_KEY_SCHEMA => array(
- 'key_documentfield' => array(
- 'columns' => array('documentID', 'fieldKey'),
- 'unique' => true,
- ),
- ),
- ) + parent::getConfiguration();
- }
-
- public function getTableName() {
- $application = $this->getApplicationName();
- $key = $this->getIndexKey();
- return "{$application}_{$key}_ffield";
- }
-
-}
diff --git a/src/applications/search/ferret/PhabricatorFerretNgrams.php b/src/applications/search/ferret/PhabricatorFerretNgrams.php
deleted file mode 100644
--- a/src/applications/search/ferret/PhabricatorFerretNgrams.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-abstract class PhabricatorFerretNgrams
- extends PhabricatorSearchDAO {
-
- protected $documentID;
- protected $ngram;
-
- abstract public function getIndexKey();
-
- protected function getConfiguration() {
- return array(
- self::CONFIG_TIMESTAMPS => false,
- self::CONFIG_COLUMN_SCHEMA => array(
- 'documentID' => 'uint32',
- 'ngram' => 'char3',
- ),
- self::CONFIG_KEY_SCHEMA => array(
- 'key_ngram' => array(
- 'columns' => array('ngram', 'documentID'),
- ),
- 'key_object' => array(
- 'columns' => array('documentID'),
- ),
- ),
- ) + parent::getConfiguration();
- }
-
- public function getTableName() {
- $application = $this->getApplicationName();
- $key = $this->getIndexKey();
- return "{$application}_{$key}_fngrams";
- }
-
-}
diff --git a/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php b/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
--- a/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
+++ b/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
@@ -1623,8 +1623,7 @@
$engine = $this->ferretEngine;
$stemmer = $engine->newStemmer();
- $ngram_table = $engine->newNgramsObject();
- $ngram_table_name = $ngram_table->getTableName();
+ $ngram_table = $engine->getNgramsTableName();
$flat = array();
foreach ($this->ferretTokens as $fulltext_token) {
@@ -1680,7 +1679,7 @@
foreach ($ngrams as $ngram) {
$flat[] = array(
- 'table' => $ngram_table_name,
+ 'table' => $ngram_table,
'ngram' => $ngram,
);
}
@@ -1702,14 +1701,14 @@
$phid_column = qsprintf($conn, '%T', 'phid');
}
- $document_table = $engine->newDocumentObject();
- $field_table = $engine->newFieldObject();
+ $document_table = $engine->getDocumentTableName();
+ $field_table = $engine->getFieldTableName();
$joins = array();
$joins[] = qsprintf(
$conn,
'JOIN %T ft_doc ON ft_doc.objectPHID = %Q',
- $document_table->getTableName(),
+ $document_table,
$phid_column);
$idx = 1;
@@ -1736,7 +1735,7 @@
$conn,
'JOIN %T %T ON ft_doc.id = %T.documentID
AND %T.fieldKey = %s',
- $field_table->getTableName(),
+ $field_table,
$alias,
$alias,
$alias,

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 21, 11:40 PM (3 w, 5 d ago)
Storage Engine
amazon-s3
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
phabricator/secure/gk/qj/q3k6kr4usun3jxzq
Default Alt Text
D18559.diff (37 KB)

Event Timeline