Search backend: add support for negated predicates
Created by: camdencheek
For most of our predicates, we can theoretically support negation. Up until now, we've explicitly disallowed negating predicates because their implementation (expanding the predicate in the query) was not performant enough to work at all unless the negation somehow excluded almost everything (-repo:contains.file(.*)
?).
Now that we implement all our predicates natively, negation is actually within reach. In fact, when I rewrote our predicates, I rewrote most of them with negation in mind, so it's not a super big lift to start enabling it.
This PR removes the "predicates are not allowed to be negated" rule and enables negation for repo:contains.file()
and repo:contains.content()
. I'm hopeful we can support performant negation on most predicates before 4.0 as part of the "make predicates good" effort.
Stacked on https://github.com/sourcegraph/sourcegraph/pull/40280 Closes #24325
Test plan
Added many integration tests