mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Add Ferret engine index support to Differential
Summary: Ref T12819. Adds storage and indexing for the Ferret engine to Differential. Test Plan: Ran `bin/search index D123 --force`, saw indexes appear in database. No UI/user impact yet. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12819 Differential Revision: https://secure.phabricator.com/D18540
This commit is contained in:
parent
64b7778f32
commit
f40f3ca74c
9 changed files with 108 additions and 0 deletions
|
@ -0,0 +1,9 @@
|
||||||
|
CREATE TABLE {$NAMESPACE}_differential.differential_revision_fdocument (
|
||||||
|
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
objectPHID VARBINARY(64) NOT NULL,
|
||||||
|
isClosed BOOL NOT NULL,
|
||||||
|
authorPHID VARBINARY(64),
|
||||||
|
ownerPHID VARBINARY(64),
|
||||||
|
epochCreated INT UNSIGNED NOT NULL,
|
||||||
|
epochModified INT UNSIGNED NOT NULL
|
||||||
|
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
|
|
@ -0,0 +1,8 @@
|
||||||
|
CREATE TABLE {$NAMESPACE}_differential.differential_revision_ffield (
|
||||||
|
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
documentID INT UNSIGNED NOT NULL,
|
||||||
|
fieldKey VARCHAR(4) NOT NULL COLLATE {$COLLATE_TEXT},
|
||||||
|
rawCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT},
|
||||||
|
termCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT},
|
||||||
|
normalCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}
|
||||||
|
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
|
|
@ -0,0 +1,5 @@
|
||||||
|
CREATE TABLE {$NAMESPACE}_differential.differential_revision_fngrams (
|
||||||
|
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
documentID INT UNSIGNED NOT NULL,
|
||||||
|
ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT}
|
||||||
|
) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
|
|
@ -532,6 +532,10 @@ phutil_register_library_map(array(
|
||||||
'DifferentialRevisionEditConduitAPIMethod' => 'applications/differential/conduit/DifferentialRevisionEditConduitAPIMethod.php',
|
'DifferentialRevisionEditConduitAPIMethod' => 'applications/differential/conduit/DifferentialRevisionEditConduitAPIMethod.php',
|
||||||
'DifferentialRevisionEditController' => 'applications/differential/controller/DifferentialRevisionEditController.php',
|
'DifferentialRevisionEditController' => 'applications/differential/controller/DifferentialRevisionEditController.php',
|
||||||
'DifferentialRevisionEditEngine' => 'applications/differential/editor/DifferentialRevisionEditEngine.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',
|
'DifferentialRevisionFulltextEngine' => 'applications/differential/search/DifferentialRevisionFulltextEngine.php',
|
||||||
'DifferentialRevisionGraph' => 'infrastructure/graph/DifferentialRevisionGraph.php',
|
'DifferentialRevisionGraph' => 'infrastructure/graph/DifferentialRevisionGraph.php',
|
||||||
'DifferentialRevisionHasChildRelationship' => 'applications/differential/relationships/DifferentialRevisionHasChildRelationship.php',
|
'DifferentialRevisionHasChildRelationship' => 'applications/differential/relationships/DifferentialRevisionHasChildRelationship.php',
|
||||||
|
@ -5522,6 +5526,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorDestructibleInterface',
|
'PhabricatorDestructibleInterface',
|
||||||
'PhabricatorProjectInterface',
|
'PhabricatorProjectInterface',
|
||||||
'PhabricatorFulltextInterface',
|
'PhabricatorFulltextInterface',
|
||||||
|
'PhabricatorFerretInterface',
|
||||||
'PhabricatorConduitResultInterface',
|
'PhabricatorConduitResultInterface',
|
||||||
'PhabricatorDraftInterface',
|
'PhabricatorDraftInterface',
|
||||||
),
|
),
|
||||||
|
@ -5545,6 +5550,10 @@ phutil_register_library_map(array(
|
||||||
'DifferentialRevisionEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
|
'DifferentialRevisionEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
|
||||||
'DifferentialRevisionEditController' => 'DifferentialController',
|
'DifferentialRevisionEditController' => 'DifferentialController',
|
||||||
'DifferentialRevisionEditEngine' => 'PhabricatorEditEngine',
|
'DifferentialRevisionEditEngine' => 'PhabricatorEditEngine',
|
||||||
|
'DifferentialRevisionFerretDocument' => 'PhabricatorFerretDocument',
|
||||||
|
'DifferentialRevisionFerretEngine' => 'PhabricatorFerretEngine',
|
||||||
|
'DifferentialRevisionFerretField' => 'PhabricatorFerretField',
|
||||||
|
'DifferentialRevisionFerretNgrams' => 'PhabricatorFerretNgrams',
|
||||||
'DifferentialRevisionFulltextEngine' => 'PhabricatorFulltextEngine',
|
'DifferentialRevisionFulltextEngine' => 'PhabricatorFulltextEngine',
|
||||||
'DifferentialRevisionGraph' => 'PhabricatorObjectGraph',
|
'DifferentialRevisionGraph' => 'PhabricatorObjectGraph',
|
||||||
'DifferentialRevisionHasChildRelationship' => 'DifferentialRevisionRelationship',
|
'DifferentialRevisionHasChildRelationship' => 'DifferentialRevisionRelationship',
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DifferentialRevisionFerretEngine
|
||||||
|
extends PhabricatorFerretEngine {
|
||||||
|
|
||||||
|
public function newNgramsObject() {
|
||||||
|
return new DifferentialRevisionFerretNgrams();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newDocumentObject() {
|
||||||
|
return new DifferentialRevisionFerretDocument();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newFieldObject() {
|
||||||
|
return new DifferentialRevisionFerretField();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getFunctionMap() {
|
||||||
|
$map = parent::getFunctionMap();
|
||||||
|
|
||||||
|
$map['body']['aliases'][] = 'summary';
|
||||||
|
|
||||||
|
return $map;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ final class DifferentialRevision extends DifferentialDAO
|
||||||
PhabricatorDestructibleInterface,
|
PhabricatorDestructibleInterface,
|
||||||
PhabricatorProjectInterface,
|
PhabricatorProjectInterface,
|
||||||
PhabricatorFulltextInterface,
|
PhabricatorFulltextInterface,
|
||||||
|
PhabricatorFerretInterface,
|
||||||
PhabricatorConduitResultInterface,
|
PhabricatorConduitResultInterface,
|
||||||
PhabricatorDraftInterface {
|
PhabricatorDraftInterface {
|
||||||
|
|
||||||
|
@ -900,6 +901,14 @@ final class DifferentialRevision extends DifferentialDAO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -( PhabricatorFerretInterface )----------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function newFerretEngine() {
|
||||||
|
return new DifferentialRevisionFerretEngine();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -( PhabricatorConduitResultInterface )---------------------------------- */
|
/* -( PhabricatorConduitResultInterface )---------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DifferentialRevisionFerretDocument
|
||||||
|
extends PhabricatorFerretDocument {
|
||||||
|
|
||||||
|
public function getApplicationName() {
|
||||||
|
return 'differential';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIndexKey() {
|
||||||
|
return 'revision';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DifferentialRevisionFerretField
|
||||||
|
extends PhabricatorFerretField {
|
||||||
|
|
||||||
|
public function getApplicationName() {
|
||||||
|
return 'differential';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIndexKey() {
|
||||||
|
return 'revision';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DifferentialRevisionFerretNgrams
|
||||||
|
extends PhabricatorFerretNgrams {
|
||||||
|
|
||||||
|
public function getApplicationName() {
|
||||||
|
return 'differential';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIndexKey() {
|
||||||
|
return 'revision';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue