@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.

Fix fatal when searching for "r matey prepare to be boarded"

Summary:
See <https://discourse.phabricator-community.org/t/unrecoverable-fatal-error-on-repository-search-in-top-search-bar/503/2>.

The Ferret engine replaced `withNameContains()`, but I missed this obscure callsite.

Test Plan:
- Searched for `r matey prepare to be boarded`.
- Before: fatal.
- After: no fatal.
- Also searched for `r <actual repository name>`, got repository.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D18661

+21 -3
+21 -3
src/applications/search/engine/PhabricatorJumpNavHandler.php
··· 50 50 return id(new AphrontRedirectResponse()) 51 51 ->setURI("/diffusion/symbol/$symbol/?jump=true$context"); 52 52 case 'find-repository': 53 - $name = $matches[1]; 53 + $raw_query = $matches[1]; 54 + 55 + $engine = id(new PhabricatorRepository()) 56 + ->newFerretEngine(); 57 + 58 + $compiler = id(new PhutilSearchQueryCompiler()) 59 + ->setEnableFunctions(true); 60 + 61 + $raw_tokens = $compiler->newTokens($raw_query); 62 + 63 + $fulltext_tokens = array(); 64 + foreach ($raw_tokens as $raw_token) { 65 + $fulltext_token = id(new PhabricatorFulltextToken()) 66 + ->setToken($raw_token); 67 + $fulltext_tokens[] = $fulltext_token; 68 + } 69 + 54 70 $repositories = id(new PhabricatorRepositoryQuery()) 55 71 ->setViewer($viewer) 56 - ->withNameContains($name) 72 + ->withFerretConstraint($engine, $fulltext_tokens) 57 73 ->execute(); 58 74 if (count($repositories) == 1) { 59 75 // Just one match, jump to repository. 60 76 $uri = head($repositories)->getURI(); 61 77 } else { 62 78 // More than one match, jump to search. 63 - $uri = urisprintf('/diffusion/?order=name&name=%s', $name); 79 + $uri = urisprintf( 80 + '/diffusion/?order=name&query=%s', 81 + $raw_query); 64 82 } 65 83 return id(new AphrontRedirectResponse())->setURI($uri); 66 84 default: