Page MenuHomePhabricator

D18736.diff
No OneTemporary

D18736.diff

diff --git a/resources/sql/autopatches/20171026.ferret.01.ponder.doc.sql b/resources/sql/autopatches/20171026.ferret.01.ponder.doc.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20171026.ferret.01.ponder.doc.sql
@@ -0,0 +1,9 @@
+CREATE TABLE {$NAMESPACE}_ponder.ponder_question_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};
diff --git a/resources/sql/autopatches/20171026.ferret.02.ponder.field.sql b/resources/sql/autopatches/20171026.ferret.02.ponder.field.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20171026.ferret.02.ponder.field.sql
@@ -0,0 +1,8 @@
+CREATE TABLE {$NAMESPACE}_ponder.ponder_question_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};
diff --git a/resources/sql/autopatches/20171026.ferret.03.ponder.ngrams.sql b/resources/sql/autopatches/20171026.ferret.03.ponder.ngrams.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20171026.ferret.03.ponder.ngrams.sql
@@ -0,0 +1,5 @@
+CREATE TABLE {$NAMESPACE}_ponder.ponder_question_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};
diff --git a/resources/sql/autopatches/20171026.ferret.04.ponder.cngrams.sql b/resources/sql/autopatches/20171026.ferret.04.ponder.cngrams.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20171026.ferret.04.ponder.cngrams.sql
@@ -0,0 +1,7 @@
+CREATE TABLE {$NAMESPACE}_ponder.ponder_question_fngrams_common (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT},
+ needsCollection BOOL NOT NULL,
+ UNIQUE KEY `key_ngram` (ngram),
+ KEY `key_collect` (needsCollection)
+) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
diff --git a/resources/sql/autopatches/20171026.ferret.05.ponder.index.php b/resources/sql/autopatches/20171026.ferret.05.ponder.index.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20171026.ferret.05.ponder.index.php
@@ -0,0 +1,11 @@
+<?php
+
+$table = new PonderQuestion();
+
+foreach (new LiskMigrationIterator($table) as $question) {
+ PhabricatorSearchWorker::queueDocumentForIndexing(
+ $question->getPHID(),
+ array(
+ 'force' => true,
+ ));
+}
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
@@ -4774,6 +4774,7 @@
'PonderQuestionEditController' => 'applications/ponder/controller/PonderQuestionEditController.php',
'PonderQuestionEditEngine' => 'applications/ponder/editor/PonderQuestionEditEngine.php',
'PonderQuestionEditor' => 'applications/ponder/editor/PonderQuestionEditor.php',
+ 'PonderQuestionFerretEngine' => 'applications/ponder/search/PonderQuestionFerretEngine.php',
'PonderQuestionFulltextEngine' => 'applications/ponder/search/PonderQuestionFulltextEngine.php',
'PonderQuestionHistoryController' => 'applications/ponder/controller/PonderQuestionHistoryController.php',
'PonderQuestionListController' => 'applications/ponder/controller/PonderQuestionListController.php',
@@ -10539,6 +10540,7 @@
'PhabricatorDestructibleInterface',
'PhabricatorSpacesInterface',
'PhabricatorFulltextInterface',
+ 'PhabricatorFerretInterface',
),
'PonderQuestionAnswerTransaction' => 'PonderQuestionTransactionType',
'PonderQuestionAnswerWikiTransaction' => 'PonderQuestionTransactionType',
@@ -10548,6 +10550,7 @@
'PonderQuestionEditController' => 'PonderController',
'PonderQuestionEditEngine' => 'PhabricatorEditEngine',
'PonderQuestionEditor' => 'PonderEditor',
+ 'PonderQuestionFerretEngine' => 'PhabricatorFerretEngine',
'PonderQuestionFulltextEngine' => 'PhabricatorFulltextEngine',
'PonderQuestionHistoryController' => 'PonderController',
'PonderQuestionListController' => 'PonderController',
diff --git a/src/applications/ponder/search/PonderQuestionFerretEngine.php b/src/applications/ponder/search/PonderQuestionFerretEngine.php
new file mode 100644
--- /dev/null
+++ b/src/applications/ponder/search/PonderQuestionFerretEngine.php
@@ -0,0 +1,18 @@
+<?php
+
+final class PonderQuestionFerretEngine
+ extends PhabricatorFerretEngine {
+
+ public function getApplicationName() {
+ return 'ponder';
+ }
+
+ public function getScopeName() {
+ return 'question';
+ }
+
+ public function newSearchEngine() {
+ return new PonderQuestionSearchEngine();
+ }
+
+}
diff --git a/src/applications/ponder/storage/PonderQuestion.php b/src/applications/ponder/storage/PonderQuestion.php
--- a/src/applications/ponder/storage/PonderQuestion.php
+++ b/src/applications/ponder/storage/PonderQuestion.php
@@ -11,7 +11,8 @@
PhabricatorProjectInterface,
PhabricatorDestructibleInterface,
PhabricatorSpacesInterface,
- PhabricatorFulltextInterface {
+ PhabricatorFulltextInterface,
+ PhabricatorFerretInterface {
const MARKUP_FIELD_CONTENT = 'markup:content';
@@ -300,4 +301,13 @@
return new PonderQuestionFulltextEngine();
}
+
+/* -( PhabricatorFerretInterface )----------------------------------------- */
+
+
+ public function newFerretEngine() {
+ return new PonderQuestionFerretEngine();
+ }
+
+
}

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 12:07 AM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6715527
Default Alt Text
D18736.diff (5 KB)

Event Timeline