Page MenuHomePhabricator

D18513.diff
No OneTemporary

D18513.diff

diff --git a/src/applications/project/engineextension/PhabricatorProjectsFulltextEngineExtension.php b/src/applications/project/engineextension/PhabricatorProjectsFulltextEngineExtension.php
--- a/src/applications/project/engineextension/PhabricatorProjectsFulltextEngineExtension.php
+++ b/src/applications/project/engineextension/PhabricatorProjectsFulltextEngineExtension.php
@@ -9,11 +9,11 @@
return pht('Projects');
}
- public function shouldIndexFulltextObject($object) {
+ public function shouldEnrichFulltextObject($object) {
return ($object instanceof PhabricatorProjectInterface);
}
- public function indexFulltextObject(
+ public function enrichFulltextObject(
$object,
PhabricatorSearchAbstractDocument $document) {
diff --git a/src/applications/search/engineextension/PhabricatorLiskFulltextEngineExtension.php b/src/applications/search/engineextension/PhabricatorLiskFulltextEngineExtension.php
--- a/src/applications/search/engineextension/PhabricatorLiskFulltextEngineExtension.php
+++ b/src/applications/search/engineextension/PhabricatorLiskFulltextEngineExtension.php
@@ -9,7 +9,7 @@
return pht('Lisk Builtin Properties');
}
- public function shouldIndexFulltextObject($object) {
+ public function shouldEnrichFulltextObject($object) {
if (!($object instanceof PhabricatorLiskDAO)) {
return false;
}
@@ -21,7 +21,7 @@
return true;
}
- public function indexFulltextObject(
+ public function enrichFulltextObject(
$object,
PhabricatorSearchAbstractDocument $document) {
diff --git a/src/applications/search/index/PhabricatorFulltextEngine.php b/src/applications/search/index/PhabricatorFulltextEngine.php
--- a/src/applications/search/index/PhabricatorFulltextEngine.php
+++ b/src/applications/search/index/PhabricatorFulltextEngine.php
@@ -26,9 +26,16 @@
$object = $this->getObject();
$extensions = PhabricatorFulltextEngineExtension::getAllExtensions();
+
+ $enrich_extensions = array();
+ $index_extensions = array();
foreach ($extensions as $key => $extension) {
- if (!$extension->shouldIndexFulltextObject($object)) {
- unset($extensions[$key]);
+ if ($extension->shouldEnrichFulltextObject($object)) {
+ $enrich_extensions[] = $extension;
+ }
+
+ if ($extension->shouldIndexFulltextObject($object)) {
+ $index_extensions[] = $extension;
}
}
@@ -36,7 +43,11 @@
$this->buildAbstractDocument($document, $object);
- foreach ($extensions as $extension) {
+ foreach ($enrich_extensions as $extension) {
+ $extension->enrichFulltextObject($object, $document);
+ }
+
+ foreach ($index_extensions as $extension) {
$extension->indexFulltextObject($object, $document);
}
diff --git a/src/applications/search/index/PhabricatorFulltextEngineExtension.php b/src/applications/search/index/PhabricatorFulltextEngineExtension.php
--- a/src/applications/search/index/PhabricatorFulltextEngineExtension.php
+++ b/src/applications/search/index/PhabricatorFulltextEngineExtension.php
@@ -12,11 +12,25 @@
abstract public function getExtensionName();
- abstract public function shouldIndexFulltextObject($object);
+ public function shouldEnrichFulltextObject($object) {
+ return false;
+ }
- abstract public function indexFulltextObject(
+ public function enrichFulltextObject(
$object,
- PhabricatorSearchAbstractDocument $document);
+ PhabricatorSearchAbstractDocument $document) {
+ return;
+ }
+
+ public function shouldIndexFulltextObject($object) {
+ return false;
+ }
+
+ public function indexFulltextObject(
+ $object,
+ PhabricatorSearchAbstractDocument $document) {
+ return;
+ }
final public static function getAllExtensions() {
return id(new PhutilClassMapQuery())
diff --git a/src/applications/subscriptions/engineextension/PhabricatorSubscriptionsFulltextEngineExtension.php b/src/applications/subscriptions/engineextension/PhabricatorSubscriptionsFulltextEngineExtension.php
--- a/src/applications/subscriptions/engineextension/PhabricatorSubscriptionsFulltextEngineExtension.php
+++ b/src/applications/subscriptions/engineextension/PhabricatorSubscriptionsFulltextEngineExtension.php
@@ -9,11 +9,11 @@
return pht('Subscribers');
}
- public function shouldIndexFulltextObject($object) {
+ public function shouldEnrichFulltextObject($object) {
return ($object instanceof PhabricatorSubscribableInterface);
}
- public function indexFulltextObject(
+ public function enrichFulltextObject(
$object,
PhabricatorSearchAbstractDocument $document) {
diff --git a/src/applications/transactions/engineextension/PhabricatorTransactionsFulltextEngineExtension.php b/src/applications/transactions/engineextension/PhabricatorTransactionsFulltextEngineExtension.php
--- a/src/applications/transactions/engineextension/PhabricatorTransactionsFulltextEngineExtension.php
+++ b/src/applications/transactions/engineextension/PhabricatorTransactionsFulltextEngineExtension.php
@@ -9,11 +9,11 @@
return pht('Comments');
}
- public function shouldIndexFulltextObject($object) {
+ public function shouldEnrichFulltextObject($object) {
return ($object instanceof PhabricatorApplicationTransactionInterface);
}
- public function indexFulltextObject(
+ public function enrichFulltextObject(
$object,
PhabricatorSearchAbstractDocument $document) {
diff --git a/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldFulltextEngineExtension.php b/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldFulltextEngineExtension.php
--- a/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldFulltextEngineExtension.php
+++ b/src/infrastructure/customfield/engineextension/PhabricatorCustomFieldFulltextEngineExtension.php
@@ -9,11 +9,11 @@
return pht('Custom Fields');
}
- public function shouldIndexFulltextObject($object) {
+ public function shouldEnrichFulltextObject($object) {
return ($object instanceof PhabricatorCustomFieldInterface);
}
- public function indexFulltextObject(
+ public function enrichFulltextObject(
$object,
PhabricatorSearchAbstractDocument $document) {

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 10, 6:51 AM (1 w, 23 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6732866
Default Alt Text
D18513.diff (6 KB)

Event Timeline