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; }