Page MenuHomePhabricator

Apply search query length limit exemption to negated queries
Closed, ResolvedPublic

Description

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?

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

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.

Change 670168 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/extensions/CirrusSearch@master] Extend query length limit exemptions to negated keywords

https://gerrit.wikimedia.org/r/670168

Change 670201 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/extensions/CirrusSearch@master] Improve error message for query length limit violations

https://gerrit.wikimedia.org/r/670201

Change 670168 merged by jenkins-bot:
[mediawiki/extensions/CirrusSearch@master] Extend query length limit exemptions to negated keywords

https://gerrit.wikimedia.org/r/670168

Change 670201 merged by jenkins-bot:
[mediawiki/extensions/CirrusSearch@master] Improve error message for query length limit violations

https://gerrit.wikimedia.org/r/670201