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 @@ -143,7 +143,8 @@ if ($query_bytes > $maximum_bytes) { throw new PhutilSearchQueryCompilerSyntaxException( pht( - 'Query is too long (%s bytes, maximum is %s bytes).', + 'Query is too long (%s bytes, maximum is %s bytes). '. + 'Please use more specific search criteria.', new PhutilNumber($query_bytes), new PhutilNumber($maximum_bytes))); } @@ -298,6 +299,18 @@ $tokens[] = $token; } + $query_tokens = count($tokens); + $maximum_tokens = 16; + if ($query_tokens > $maximum_tokens) { + throw new PhutilSearchQueryCompilerSyntaxException( + pht( + 'Query has too many search tokens (%s tokens, maximum is %s '. + 'tokens). Please use more specific search criteria.', + new PhutilNumber($query_tokens), + new PhutilNumber($maximum_tokens))); + } + + $results = array(); $last_function = null; foreach ($tokens as $token) {