Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15341334
D14836.id35891.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D14836.id35891.diff
View Options
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
@@ -1294,9 +1294,9 @@
'ManiphestHovercardEventListener' => 'applications/maniphest/event/ManiphestHovercardEventListener.php',
'ManiphestInfoConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php',
'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php',
- 'ManiphestNameIndexEventListener' => 'applications/maniphest/event/ManiphestNameIndexEventListener.php',
'ManiphestPriorityConfigOptionType' => 'applications/maniphest/config/ManiphestPriorityConfigOptionType.php',
'ManiphestPriorityEmailCommand' => 'applications/maniphest/command/ManiphestPriorityEmailCommand.php',
+ 'ManiphestProjectNameFulltextEngineExtension' => 'applications/maniphest/engineextension/ManiphestProjectNameFulltextEngineExtension.php',
'ManiphestQueryConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestQueryConduitAPIMethod.php',
'ManiphestQueryStatusesConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestQueryStatusesConduitAPIMethod.php',
'ManiphestRemarkupRule' => 'applications/maniphest/remarkup/ManiphestRemarkupRule.php',
@@ -5338,9 +5338,9 @@
'ManiphestHovercardEventListener' => 'PhabricatorEventListener',
'ManiphestInfoConduitAPIMethod' => 'ManiphestConduitAPIMethod',
'ManiphestNameIndex' => 'ManiphestDAO',
- 'ManiphestNameIndexEventListener' => 'PhabricatorEventListener',
'ManiphestPriorityConfigOptionType' => 'PhabricatorConfigJSONOptionType',
'ManiphestPriorityEmailCommand' => 'ManiphestEmailCommand',
+ 'ManiphestProjectNameFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension',
'ManiphestQueryConduitAPIMethod' => 'ManiphestConduitAPIMethod',
'ManiphestQueryStatusesConduitAPIMethod' => 'ManiphestConduitAPIMethod',
'ManiphestRemarkupRule' => 'PhabricatorObjectRemarkupRule',
diff --git a/src/applications/maniphest/application/PhabricatorManiphestApplication.php b/src/applications/maniphest/application/PhabricatorManiphestApplication.php
--- a/src/applications/maniphest/application/PhabricatorManiphestApplication.php
+++ b/src/applications/maniphest/application/PhabricatorManiphestApplication.php
@@ -38,7 +38,6 @@
public function getEventListeners() {
return array(
- new ManiphestNameIndexEventListener(),
new ManiphestHovercardEventListener(),
);
}
diff --git a/src/applications/maniphest/engineextension/ManiphestProjectNameFulltextEngineExtension.php b/src/applications/maniphest/engineextension/ManiphestProjectNameFulltextEngineExtension.php
new file mode 100644
--- /dev/null
+++ b/src/applications/maniphest/engineextension/ManiphestProjectNameFulltextEngineExtension.php
@@ -0,0 +1,25 @@
+<?php
+
+final class ManiphestProjectNameFulltextEngineExtension
+ extends PhabricatorFulltextEngineExtension {
+
+ const EXTENSIONKEY = 'maniphest.project.name';
+
+ public function getExtensionName() {
+ return pht('Maniphest Project Name Cache');
+ }
+
+ public function shouldIndexFulltextObject($object) {
+ return ($object instanceof PhabricatorProject);
+ }
+
+ public function indexFulltextObject(
+ $object,
+ PhabricatorSearchAbstractDocument $document) {
+
+ ManiphestNameIndex::updateIndex(
+ $object->getPHID(),
+ $object->getName());
+ }
+
+}
diff --git a/src/applications/maniphest/event/ManiphestNameIndexEventListener.php b/src/applications/maniphest/event/ManiphestNameIndexEventListener.php
deleted file mode 100644
--- a/src/applications/maniphest/event/ManiphestNameIndexEventListener.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-final class ManiphestNameIndexEventListener extends PhabricatorEventListener {
-
- public function register() {
- $this->listen(PhabricatorEventType::TYPE_SEARCH_DIDUPDATEINDEX);
- }
-
- public function handleEvent(PhutilEvent $event) {
- $phid = $event->getValue('phid');
- $type = phid_get_type($phid);
-
- // For now, we only index projects.
- if ($type != PhabricatorProjectProjectPHIDType::TYPECONST) {
- return;
- }
-
- $document = $event->getValue('document');
-
- ManiphestNameIndex::updateIndex(
- $phid,
- $document->getDocumentTitle());
- }
-
-}
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
@@ -66,8 +66,6 @@
$engine = PhabricatorSearchEngine::loadEngine();
$engine->reindexAbstractDocument($document);
- $this->dispatchDidUpdateIndexEvent($phid, $document);
-
return $this;
}
@@ -99,19 +97,4 @@
}
}
- private function dispatchDidUpdateIndexEvent(
- $phid,
- PhabricatorSearchAbstractDocument $document) {
-
- $event = new PhabricatorEvent(
- PhabricatorEventType::TYPE_SEARCH_DIDUPDATEINDEX,
- array(
- 'phid' => $phid,
- 'object' => $this->loadDocumentByPHID($phid),
- 'document' => $document,
- ));
- $event->setUser($this->getViewer());
- PhutilEventEngine::dispatchEvent($event);
- }
-
}
diff --git a/src/docs/user/userguide/events.diviner b/src/docs/user/userguide/events.diviner
--- a/src/docs/user/userguide/events.diviner
+++ b/src/docs/user/userguide/events.diviner
@@ -188,41 +188,6 @@
Using @{class@libphutil:PhutilEmailAddress} may be helpful in parsing the query.
-== Search: Did Update Index ==
-
-The constant for this event is
-`PhabricatorEventType::TYPE_SEARCH_DIDUPDATEINDEX`.
-
-This event is dispatched from the Search application's indexing engine, after
-it indexes a document. It allows you to publish search-like indexes into other
-systems.
-
-Note that this event happens after the update is fully complete: you can not
-prevent or modify the update. Further, the event may fire significantly later
-in real time than the update, as indexing may occur in the background. You
-should use other events if you need guarantees about when the event executes.
-
-Finally, this event may fire more than once for a single update. For example,
-if the search indexes are rebuilt, this event will fire on objects which have
-not actually changed.
-
-So, good use cases for event listeners are:
-
- - Updating secondary search indexes.
-
-Bad use cases are:
-
- - Editing the object or document.
- - Anything with side effects, like sending email.
-
-Data available on this event:
-
- - `phid` The PHID of the updated object.
- - `object` The object which was updated (like a @{class:ManiphesTask}).
- - `document` The @{class:PhabricatorSearchAbstractDocument} which was indexed.
- This contains an abstract representation of the object, and may be useful
- in populating secondary indexes because it provides a uniform API.
-
== Test: Did Run Test ==
The constant for this event is
diff --git a/src/infrastructure/events/constant/PhabricatorEventType.php b/src/infrastructure/events/constant/PhabricatorEventType.php
--- a/src/infrastructure/events/constant/PhabricatorEventType.php
+++ b/src/infrastructure/events/constant/PhabricatorEventType.php
@@ -27,6 +27,4 @@
const TYPE_AUTH_WILLLOGINUSER = 'auth.willLoginUser';
const TYPE_AUTH_DIDVERIFYEMAIL = 'auth.didVerifyEmail';
- const TYPE_SEARCH_DIDUPDATEINDEX = 'search.didUpdateIndex';
-
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 10, 7:46 PM (1 d, 5 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7468323
Default Alt Text
D14836.id35891.diff (7 KB)
Attached To
Mode
D14836: Remove TYPE_SEARCH_DIDUPDATEINDEX event
Attached
Detach File
Event Timeline
Log In to Comment