@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Ferret Fulltext search: Do not query data of uninstalled apps

Summary:
When using the default global fulltext search (many of our users do unfortunately), Phorge makes every available SearchEngine run a query. This also includes queries in database of uninstalled applications. This may decrease performance, plus any potential results are not listed anyway as the corresponding application to render them is not available. Thus drop out early in that case.

Closes T16123

Test Plan:
1. Temporarily uninstall some applications via http://phorge.localhost/applications/ (for example http://phorge.localhost/applications/view/PhabricatorFundApplication/ after running `./bin/config set phabricator.show-prototypes true`)
2. Enable Darkconsole via http://phorge.localhost/config/edit/darkconsole.always-on/
3. Go to http://phorge.localhost/search/query/advanced/
4. Enter random search terms in the `Query` field, hit the `Search` button
5. Look at the resulting SQL queries in DarkConsole by searching for `connect` and `query` entries, do not see `localhost:phabricator_uninstalledapp` and `SELECT ngram FROM uninstalledapp_somesuffix_fngrams_common` entries anymore

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

Subscribers: mainframe98, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16123

Differential Revision: https://we.phorge.it/D26111

+9 -3
+9 -3
src/applications/search/fulltextstorage/PhabricatorFerretFulltextStorageEngine.php
··· 60 60 $engine = $spec['engine']; 61 61 $object = $spec['object']; 62 62 63 + $search_engine = $engine->newSearchEngine() 64 + ->setViewer($viewer); 65 + 66 + // Ignore result objects from SearchEngines belonging to uninstalled apps 67 + $app_class = $search_engine->getApplicationClassName(); 68 + $app = PhabricatorApplication::isClassInstalled($app_class); 69 + if (!$app) { 70 + continue; 71 + } 63 72 $local_query = new PhabricatorSavedQuery(); 64 73 $local_query->setParameter('query', $query->getParameter('query')); 65 74 ··· 72 81 if ($subscriber_phids) { 73 82 $local_query->setParameter('subscriberPHIDs', $subscriber_phids); 74 83 } 75 - 76 - $search_engine = $engine->newSearchEngine() 77 - ->setViewer($viewer); 78 84 79 85 $engine_query = $search_engine->buildQueryFromSavedQuery($local_query) 80 86 ->setViewer($viewer);