Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13972971
D8185.id18526.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D8185.id18526.diff
View Options
Index: src/applications/maniphest/search/ManiphestSearchIndexer.php
===================================================================
--- src/applications/maniphest/search/ManiphestSearchIndexer.php
+++ src/applications/maniphest/search/ManiphestSearchIndexer.php
@@ -81,6 +81,8 @@
time());
}
+ $this->indexCustomFields($doc, $task);
+
return $doc;
}
}
Index: src/applications/people/search/PhabricatorUserSearchIndexer.php
===================================================================
--- src/applications/people/search/PhabricatorUserSearchIndexer.php
+++ 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;
}
}
Index: src/applications/project/search/PhabricatorProjectSearchIndexer.php
===================================================================
--- src/applications/project/search/PhabricatorProjectSearchIndexer.php
+++ 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.
Index: src/applications/search/index/PhabricatorSearchDocumentIndexer.php
===================================================================
--- src/applications/search/index/PhabricatorSearchDocumentIndexer.php
+++ 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) {
Index: src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
===================================================================
--- src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ 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
Details
Attached
Mime Type
text/plain
Expires
Oct 18 2024, 10:08 PM (4 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6728938
Default Alt Text
D8185.id18526.diff (4 KB)
Attached To
Mode
D8185: Rebuild custom field indexes when rebuilding standard/fulltext search indexes
Attached
Detach File
Event Timeline
Log In to Comment