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

Make the Ferret query compiler keep functions sticky across non-initial quoted tokens

Summary: Ref T13509. In `title:big "red" dog`, keep "title" sticky across all three terms, since this seems like it's probably the best match for intent.

Test Plan: Added unit tests; ran unit tests.

Maniphest Tasks: T13509

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

+16 -1
+8 -1
src/applications/search/compiler/PhutilSearchQueryCompiler.php
··· 358 358 359 359 $result['function'] = $function; 360 360 361 - $is_sticky = !$result['quoted']; 361 + // Note that the function remains sticky across quoted terms appearing 362 + // after the function term. For example, all of these terms are title 363 + // terms: 364 + // 365 + // title:a "b c" d 366 + 367 + $is_sticky = (!$result['quoted'] || ($token['function'] === null)); 368 + 362 369 switch ($operator) { 363 370 case self::OPERATOR_ABSENT: 364 371 case self::OPERATOR_PRESENT:
+8
src/applications/search/compiler/__tests__/PhutilSearchQueryCompilerTestCase.php
··· 185 185 array(null, $op_and, 'x'), 186 186 ), 187 187 188 + // Functions like "title:" continue to stick across quotes if the 189 + // quotes aren't the initial argument. 190 + 'title:a "b c" d' => array( 191 + array('title', $op_and, 'a'), 192 + array('title', $op_and, 'b c'), 193 + array('title', $op_and, 'd'), 194 + ), 195 + 188 196 // These queries require a field be both present and absent, which is 189 197 // impossible. 190 198 'title:- title:x' => false,