support 'negated' NestedFilters with 🆕 NegatedNestedFilter#4519
Merged
twrichards merged 1 commit intomainfrom Sep 9, 2025
Merged
support 'negated' NestedFilters with 🆕 NegatedNestedFilter#4519twrichards merged 1 commit intomainfrom
NegatedNestedFilter#4519twrichards merged 1 commit intomainfrom
Conversation
…55-feature-small-usages-searches-cant-be-used-in-exclusions Co-authored-by: Frederick O'Brien <frederick.obrien@guardian.co.uk>
Fweddi
reviewed
Sep 8, 2025
Comment on lines
+120
to
+122
| val queryWithNestedAndNormal = listOfNestedToQueries(nested).foldLeft(queryWithNormal) { case (q, nestedQ) => q.withMust(nestedQ) } | ||
|
|
||
| listOfNestedToQueries(negationNested).foldLeft(queryWithNestedAndNormal) { case (q, negNestedQ) => q.withNot(negNestedQ) } |
Contributor
There was a problem hiding this comment.
I can just about make out what's happening here but it could do with some more clarity?
Fweddi
approved these changes
Sep 8, 2025
|
Seen on auth, usage, image-loader, metadata-editor, thrall, leases, cropper, collections, media-api, kahuna (merged by @twrichards 11 minutes and 52 seconds ago) Please check your changes! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Co-authored-by: @frederickobrien
As per https://trello.com/c/6YFv1T5L/955-feature-small-usages-searches-cant-be-used-in-exclusions until now we haven't been able to perform a negated search (a.k.a. NOT - signified by the
-on the chip, rather than+) onusages@...(i.e.NestedFieldsbecause such a 'term' in the query was simply ignored, because there was no logic to deal with it and map/convert it to the ElasticSearch clause... this PR adds that logic 🎉This also unblocks #3998 (as there we want to hide
usage@status:replacedfrom search by default) which is somewhat urgent (so we don't need to merge #4498).