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

Update Phabricator to use intermediate tokens from the query compiler

Summary:
Depends on D17669. Ref T12137. Ref T12003. Ref T2632. Ref T7860.

Converts Phabricator to the new parse + compile workflow with intermediate tokens.

Also fixes a bug where searches for `cat"` or similar (unmatched quotes) wouldn't produce a nice exception.

Test Plan:
- Fulltext searched.
- Fulltext searched in Conpherence.
- Fulltext searched with bad syntax.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12137, T12003, T7860, T2632

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

+11 -6
+3 -3
src/applications/conpherence/query/ConpherenceFulltextQuery.php
··· 56 56 } 57 57 58 58 if (strlen($this->fulltext)) { 59 - $compiled_query = PhabricatorSearchDocument::newQueryCompiler() 60 - ->setQuery($this->fulltext) 61 - ->compileQuery(); 59 + $compiler = PhabricatorSearchDocument::newQueryCompiler(); 60 + $tokens = $compiler->newTokens($this->fulltext); 61 + $compiled_query = $compiler->compileQuery($tokens); 62 62 63 63 $where[] = qsprintf( 64 64 $conn_r,
+4 -3
src/applications/search/fulltextstorage/PhabricatorMySQLFulltextStorageEngine.php
··· 398 398 $stemmer = new PhutilSearchStemmer(); 399 399 400 400 $compiler = PhabricatorSearchDocument::newQueryCompiler() 401 - ->setQuery($raw_query) 402 401 ->setStemmer($stemmer); 403 402 403 + $tokens = $compiler->newTokens($raw_query); 404 + 404 405 $queries = array(); 405 - $queries[] = $compiler->compileLiteralQuery(); 406 - $queries[] = $compiler->compileStemmedQuery(); 406 + $queries[] = $compiler->compileLiteralQuery($tokens); 407 + $queries[] = $compiler->compileStemmedQuery($tokens); 407 408 408 409 return implode(' ', array_filter($queries)); 409 410 }
+4
src/infrastructure/cluster/search/PhabricatorSearchService.php
··· 253 253 $res = $engine->executeSearch($query); 254 254 // return immediately if we get results 255 255 return $res; 256 + } catch (PhutilSearchQueryCompilerSyntaxException $ex) { 257 + // If there's a query compilation error, return it directly to the 258 + // user: they issued a query with bad syntax. 259 + throw $ex; 256 260 } catch (Exception $ex) { 257 261 $exceptions[] = $ex; 258 262 }