Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15341946
D17670.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D17670.diff
View Options
diff --git a/src/applications/conpherence/query/ConpherenceFulltextQuery.php b/src/applications/conpherence/query/ConpherenceFulltextQuery.php
--- a/src/applications/conpherence/query/ConpherenceFulltextQuery.php
+++ b/src/applications/conpherence/query/ConpherenceFulltextQuery.php
@@ -56,9 +56,9 @@
}
if (strlen($this->fulltext)) {
- $compiled_query = PhabricatorSearchDocument::newQueryCompiler()
- ->setQuery($this->fulltext)
- ->compileQuery();
+ $compiler = PhabricatorSearchDocument::newQueryCompiler();
+ $tokens = $compiler->newTokens($this->fulltext);
+ $compiled_query = $compiler->compileQuery($tokens);
$where[] = qsprintf(
$conn_r,
diff --git a/src/applications/search/fulltextstorage/PhabricatorMySQLFulltextStorageEngine.php b/src/applications/search/fulltextstorage/PhabricatorMySQLFulltextStorageEngine.php
--- a/src/applications/search/fulltextstorage/PhabricatorMySQLFulltextStorageEngine.php
+++ b/src/applications/search/fulltextstorage/PhabricatorMySQLFulltextStorageEngine.php
@@ -398,12 +398,13 @@
$stemmer = new PhutilSearchStemmer();
$compiler = PhabricatorSearchDocument::newQueryCompiler()
- ->setQuery($raw_query)
->setStemmer($stemmer);
+ $tokens = $compiler->newTokens($raw_query);
+
$queries = array();
- $queries[] = $compiler->compileLiteralQuery();
- $queries[] = $compiler->compileStemmedQuery();
+ $queries[] = $compiler->compileLiteralQuery($tokens);
+ $queries[] = $compiler->compileStemmedQuery($tokens);
return implode(' ', array_filter($queries));
}
diff --git a/src/infrastructure/cluster/search/PhabricatorSearchService.php b/src/infrastructure/cluster/search/PhabricatorSearchService.php
--- a/src/infrastructure/cluster/search/PhabricatorSearchService.php
+++ b/src/infrastructure/cluster/search/PhabricatorSearchService.php
@@ -253,6 +253,10 @@
$res = $engine->executeSearch($query);
// return immediately if we get results
return $res;
+ } catch (PhutilSearchQueryCompilerSyntaxException $ex) {
+ // If there's a query compilation error, return it directly to the
+ // user: they issued a query with bad syntax.
+ throw $ex;
} catch (Exception $ex) {
$exceptions[] = $ex;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 10, 9:00 PM (1 d, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7472313
Default Alt Text
D17670.diff (2 KB)
Attached To
Mode
D17670: Update Phabricator to use intermediate tokens from the query compiler
Attached
Detach File
Event Timeline
Log In to Comment