Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15388787
D21111.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D21111.diff
View Options
diff --git a/src/applications/search/compiler/PhutilSearchQueryCompiler.php b/src/applications/search/compiler/PhutilSearchQueryCompiler.php
--- a/src/applications/search/compiler/PhutilSearchQueryCompiler.php
+++ b/src/applications/search/compiler/PhutilSearchQueryCompiler.php
@@ -358,7 +358,14 @@
$result['function'] = $function;
- $is_sticky = !$result['quoted'];
+ // Note that the function remains sticky across quoted terms appearing
+ // after the function term. For example, all of these terms are title
+ // terms:
+ //
+ // title:a "b c" d
+
+ $is_sticky = (!$result['quoted'] || ($token['function'] === null));
+
switch ($operator) {
case self::OPERATOR_ABSENT:
case self::OPERATOR_PRESENT:
diff --git a/src/applications/search/compiler/__tests__/PhutilSearchQueryCompilerTestCase.php b/src/applications/search/compiler/__tests__/PhutilSearchQueryCompilerTestCase.php
--- a/src/applications/search/compiler/__tests__/PhutilSearchQueryCompilerTestCase.php
+++ b/src/applications/search/compiler/__tests__/PhutilSearchQueryCompilerTestCase.php
@@ -185,6 +185,14 @@
array(null, $op_and, 'x'),
),
+ // Functions like "title:" continue to stick across quotes if the
+ // quotes aren't the initial argument.
+ 'title:a "b c" d' => array(
+ array('title', $op_and, 'a'),
+ array('title', $op_and, 'b c'),
+ array('title', $op_and, 'd'),
+ ),
+
// These queries require a field be both present and absent, which is
// impossible.
'title:- title:x' => false,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 4:23 AM (1 w, 6 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7705729
Default Alt Text
D21111.diff (1 KB)
Attached To
Mode
D21111: Make the Ferret query compiler keep functions sticky across non-initial quoted tokens
Attached
Detach File
Event Timeline
Log In to Comment