Page MenuHomePhabricator

D8185.id18509.diff
No OneTemporary

D8185.id18509.diff

diff --git a/src/applications/maniphest/search/ManiphestSearchIndexer.php b/src/applications/maniphest/search/ManiphestSearchIndexer.php
--- a/src/applications/maniphest/search/ManiphestSearchIndexer.php
+++ b/src/applications/maniphest/search/ManiphestSearchIndexer.php
@@ -81,6 +81,8 @@
time());
}
+ $this->indexCustomFields($doc, $task);
+
return $doc;
}
}
diff --git a/src/applications/people/customfield/PhabricatorUserConfiguredCustomField.php b/src/applications/people/customfield/PhabricatorUserConfiguredCustomField.php
--- a/src/applications/people/customfield/PhabricatorUserConfiguredCustomField.php
+++ b/src/applications/people/customfield/PhabricatorUserConfiguredCustomField.php
@@ -14,4 +14,16 @@
PhabricatorEnv::getEnvConfig('user.custom-field-definitions', array()));
}
+ public function newStorageObject() {
+ return new PhabricatorUserConfiguredCustomFieldStorage();
+ }
+
+ protected function newStringIndexStorage() {
+ return new PhabricatorUserCustomFieldStringIndex();
+ }
+
+ protected function newNumericIndexStorage() {
+ return new PhabricatorUserCustomFieldNumericIndex();
+ }
+
}
diff --git a/src/applications/people/search/PhabricatorUserSearchIndexer.php b/src/applications/people/search/PhabricatorUserSearchIndexer.php
--- a/src/applications/people/search/PhabricatorUserSearchIndexer.php
+++ b/src/applications/people/search/PhabricatorUserSearchIndexer.php
@@ -17,9 +17,6 @@
$doc->setDocumentCreated($user->getDateCreated());
$doc->setDocumentModified($user->getDateModified());
- // TODO: Index the blurbs from their profile or something? Probably not
- // actually useful...
-
$doc->addRelationship(
$user->isUserActivated()
? PhabricatorSearchRelationship::RELATIONSHIP_OPEN
@@ -28,6 +25,8 @@
PhabricatorPeoplePHIDTypeUser::TYPECONST,
time());
+ $this->indexCustomFields($doc, $user);
+
return $doc;
}
}
diff --git a/src/applications/project/search/PhabricatorProjectSearchIndexer.php b/src/applications/project/search/PhabricatorProjectSearchIndexer.php
--- a/src/applications/project/search/PhabricatorProjectSearchIndexer.php
+++ b/src/applications/project/search/PhabricatorProjectSearchIndexer.php
@@ -17,6 +17,9 @@
$doc->setDocumentCreated($project->getDateCreated());
$doc->setDocumentModified($project->getDateModified());
+ $this->indexSubscribers($doc);
+ $this->indexCustomFields($doc, $project);
+
// NOTE: This could be more full-featured, but for now we're mostly
// interested in the side effects of indexing.
diff --git a/src/applications/search/index/PhabricatorSearchDocumentIndexer.php b/src/applications/search/index/PhabricatorSearchDocumentIndexer.php
--- a/src/applications/search/index/PhabricatorSearchDocumentIndexer.php
+++ b/src/applications/search/index/PhabricatorSearchDocumentIndexer.php
@@ -106,6 +106,29 @@
}
}
+ protected function indexCustomFields(
+ PhabricatorSearchAbstractDocument $doc,
+ PhabricatorCustomFieldInterface $object) {
+
+ // Rebuild the ApplicationSearch indexes. These are internal and not part of
+ // the fulltext search, but putting them in this workflow allows users to
+ // use the same tools to rebuild the indexes, which is easy to understand.
+
+ $field_list = PhabricatorCustomField::getObjectFields(
+ $object,
+ PhabricatorCustomField::ROLE_APPLICATIONSEARCH);
+
+ $field_list->setViewer($this->getViewer());
+ $field_list->readFieldsFromStorage($object);
+ $field_list->rebuildIndexes($object);
+
+ // We could also allow fields to provide fulltext content, and index it
+ // here on the document. No one has asked for this yet, though, and the
+ // existing "search" key isn't a good fit to interpret to mean we should
+ // index stuff here, since it can be set on a lot of fields which don't
+ // contain anything resembling fulltext.
+ }
+
private function dispatchDidUpdateIndexEvent(
$phid,
PhabricatorSearchAbstractDocument $document) {
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -591,6 +591,11 @@
// need it to be up to date once the next page loads, but if we don't go
// there we we could move it into search once search moves to the daemons.
+ // It now happens in the search indexer as well, but the search indexer is
+ // always daemonized, so the logic above still potentially holds. We could
+ // possibly get rid of this. The major motivation for putting it in the
+ // indexer was to enable reindexing to work.
+
$fields = PhabricatorCustomField::getObjectFields(
$object,
PhabricatorCustomField::ROLE_APPLICATIONSEARCH);

File Metadata

Mime Type
text/plain
Expires
Sat, May 11, 1:50 PM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6281924
Default Alt Text
D8185.id18509.diff (4 KB)

Event Timeline