From 894d9b658706a492722f0c3a6d8ffc7259aeea3e Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 16 Apr 2020 10:27:01 -0700 Subject: [PATCH] Remove Ferret function aliases and overrides Summary: Ref T13511. Ferret functions currently define "aliases", and some applications override the default aliases. This probably isn't really the right model, since it means the available function aliases in global search depend on the types of documents you're searching for. This isn't fundamentally unworkable but is kind of weird. Regardless, these don't actually work. Searching for "description:x" is a syntax error. Since they don't work, it's a good bet no one is relying on them. Just get rid of them until there's a clearer argument for the feature. Test Plan: Grepped for "getFunctionMap", got no other hits. Ran some queries with the alias functions, got syntax errors. Maniphest Tasks: T13511 Differential Revision: https://secure.phabricator.com/D21130 --- .../search/DifferentialRevisionFerretEngine.php | 8 -------- .../maniphest/search/ManiphestTaskFerretEngine.php | 9 --------- .../search/ferret/PhabricatorFerretEngine.php | 11 +---------- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/applications/differential/search/DifferentialRevisionFerretEngine.php b/src/applications/differential/search/DifferentialRevisionFerretEngine.php index 2fc7d5905e..76a7a4a4fb 100644 --- a/src/applications/differential/search/DifferentialRevisionFerretEngine.php +++ b/src/applications/differential/search/DifferentialRevisionFerretEngine.php @@ -15,12 +15,4 @@ final class DifferentialRevisionFerretEngine return new DifferentialRevisionSearchEngine(); } - protected function getFunctionMap() { - $map = parent::getFunctionMap(); - - $map['body']['aliases'][] = 'summary'; - - return $map; - } - } diff --git a/src/applications/maniphest/search/ManiphestTaskFerretEngine.php b/src/applications/maniphest/search/ManiphestTaskFerretEngine.php index 45b90471ea..31c81ab2d3 100644 --- a/src/applications/maniphest/search/ManiphestTaskFerretEngine.php +++ b/src/applications/maniphest/search/ManiphestTaskFerretEngine.php @@ -15,13 +15,4 @@ final class ManiphestTaskFerretEngine return new ManiphestTaskSearchEngine(); } - protected function getFunctionMap() { - $map = parent::getFunctionMap(); - - $map['body']['aliases'][] = 'desc'; - $map['body']['aliases'][] = 'description'; - - return $map; - } - } diff --git a/src/applications/search/ferret/PhabricatorFerretEngine.php b/src/applications/search/ferret/PhabricatorFerretEngine.php index 48b2f192a4..ffba15c369 100644 --- a/src/applications/search/ferret/PhabricatorFerretEngine.php +++ b/src/applications/search/ferret/PhabricatorFerretEngine.php @@ -29,31 +29,22 @@ abstract class PhabricatorFerretEngine extends Phobject { return $map[$function]['field']; } - protected function getFunctionMap() { + private function getFunctionMap() { return array( 'all' => array( 'field' => PhabricatorSearchDocumentFieldType::FIELD_ALL, - 'aliases' => array( - 'any', - ), ), 'title' => array( 'field' => PhabricatorSearchDocumentFieldType::FIELD_TITLE, - 'aliases' => array(), ), 'body' => array( 'field' => PhabricatorSearchDocumentFieldType::FIELD_BODY, - 'aliases' => array(), ), 'core' => array( 'field' => PhabricatorSearchDocumentFieldType::FIELD_CORE, - 'aliases' => array(), ), 'comment' => array( 'field' => PhabricatorSearchDocumentFieldType::FIELD_COMMENT, - 'aliases' => array( - 'comments', - ), ), ); }