diff --git a/src/applications/search/query/PhabricatorFulltextToken.php b/src/applications/search/query/PhabricatorFulltextToken.php --- a/src/applications/search/query/PhabricatorFulltextToken.php +++ b/src/applications/search/query/PhabricatorFulltextToken.php @@ -3,9 +3,11 @@ final class PhabricatorFulltextToken extends Phobject { private $token; - private $isShort; - private $isStopword; + /** + * @param PhutilSearchQueryToken $token + * @return $this + */ public function setToken(PhutilSearchQueryToken $token) { $this->token = $token; return $this; @@ -18,28 +20,9 @@ return $this->token; } - public function isQueryable() { - return !$this->getIsShort() && !$this->getIsStopword(); - } - - public function setIsShort($is_short) { - $this->isShort = $is_short; - return $this; - } - - public function getIsShort() { - return $this->isShort; - } - - public function setIsStopword($is_stopword) { - $this->isStopword = $is_stopword; - return $this; - } - - public function getIsStopword() { - return $this->isStopword; - } - + /** + * @return PHUITagView A visual tag rendering the token string + */ public function newTag() { $token = $this->getToken(); @@ -52,39 +35,31 @@ $name = pht('%s: %s', $function, $name); } - if ($this->getIsShort()) { - $shade = PHUITagView::COLOR_GREY; - $tip = pht('Ignored Short Word'); - } else if ($this->getIsStopword()) { - $shade = PHUITagView::COLOR_GREY; - $tip = pht('Ignored Common Word'); - } else { - $operator = $token->getOperator(); - switch ($operator) { - case PhutilSearchQueryCompiler::OPERATOR_NOT: - $shade = PHUITagView::COLOR_RED; - $icon = 'fa-minus'; - break; - case PhutilSearchQueryCompiler::OPERATOR_SUBSTRING: - $tip = pht('Substring Search'); - $shade = PHUITagView::COLOR_VIOLET; - break; - case PhutilSearchQueryCompiler::OPERATOR_EXACT: - $tip = pht('Exact Search'); - $shade = PHUITagView::COLOR_GREEN; - break; - case PhutilSearchQueryCompiler::OPERATOR_PRESENT: - $name = pht('Field Present: %s', $function); - $shade = PHUITagView::COLOR_GREEN; - break; - case PhutilSearchQueryCompiler::OPERATOR_ABSENT: - $name = pht('Field Absent: %s', $function); - $shade = PHUITagView::COLOR_RED; - break; - default: - $shade = PHUITagView::COLOR_BLUE; - break; - } + $operator = $token->getOperator(); + switch ($operator) { + case PhutilSearchQueryCompiler::OPERATOR_NOT: + $shade = PHUITagView::COLOR_RED; + $icon = 'fa-minus'; + break; + case PhutilSearchQueryCompiler::OPERATOR_SUBSTRING: + $tip = pht('Substring Search'); + $shade = PHUITagView::COLOR_VIOLET; + break; + case PhutilSearchQueryCompiler::OPERATOR_EXACT: + $tip = pht('Exact Search'); + $shade = PHUITagView::COLOR_GREEN; + break; + case PhutilSearchQueryCompiler::OPERATOR_PRESENT: + $name = pht('Field Present: %s', $function); + $shade = PHUITagView::COLOR_GREEN; + break; + case PhutilSearchQueryCompiler::OPERATOR_ABSENT: + $name = pht('Field Absent: %s', $function); + $shade = PHUITagView::COLOR_RED; + break; + default: + $shade = PHUITagView::COLOR_BLUE; + break; } $tag = id(new PHUITagView())