Some search keywords, listed in QueryStringRegexParser::UNLIMITED_KEYWORDS, are allowed to have long parameter lists which do not count towards the query length limit. The way the code is written, the same exemption doesn't apply when the term is negated. Sometimes long negated terms can be useful (the specific use case I ran into is expressing "article does not have any ORES topic" - pointless in production but somewhat useful in a local environment for generating search data for pages). On the other hand the performance of the negated query is not necessarily the same as the performance of the original, so I'm not sure if it's same to assume that the negation of a long term is fine just because the original is fine. So, would it make sense to exempt negations?
This makes perfect sense and I think this can be considered a bug. I think that the code simply ignores that the keyword node (in the AST) can be wrapped inside a NegatedNode and will incorrectly skip negated keywords.