diff --git a/src/applications/maniphest/search/ManiphestSearchIndexer.php b/src/applications/maniphest/search/ManiphestSearchIndexer.php index 53c20960a9..9d67fcf212 100644 --- a/src/applications/maniphest/search/ManiphestSearchIndexer.php +++ b/src/applications/maniphest/search/ManiphestSearchIndexer.php @@ -81,6 +81,8 @@ final class ManiphestSearchIndexer time()); } + $this->indexCustomFields($doc, $task); + return $doc; } } diff --git a/src/applications/people/search/PhabricatorUserSearchIndexer.php b/src/applications/people/search/PhabricatorUserSearchIndexer.php index 56b53c51ab..8d74334ee9 100644 --- a/src/applications/people/search/PhabricatorUserSearchIndexer.php +++ b/src/applications/people/search/PhabricatorUserSearchIndexer.php @@ -17,9 +17,6 @@ final class PhabricatorUserSearchIndexer $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 @@ final class PhabricatorUserSearchIndexer 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 index f46796163f..faffced07a 100644 --- a/src/applications/project/search/PhabricatorProjectSearchIndexer.php +++ b/src/applications/project/search/PhabricatorProjectSearchIndexer.php @@ -17,6 +17,9 @@ final class PhabricatorProjectSearchIndexer $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 index 5bb88c9bdb..1965c55809 100644 --- a/src/applications/search/index/PhabricatorSearchDocumentIndexer.php +++ b/src/applications/search/index/PhabricatorSearchDocumentIndexer.php @@ -106,6 +106,29 @@ abstract class PhabricatorSearchDocumentIndexer { } } + 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 index d7107e16e3..611d6675fb 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -591,6 +591,11 @@ abstract class PhabricatorApplicationTransactionEditor // 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);