Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix behaviour of 'when filter empty' for empty and notEmpty filter types. #13633

Merged
merged 2 commits into from
May 8, 2024

Conversation

samwho
Copy link
Collaborator

@samwho samwho commented May 7, 2024

Description

Originally discovered while investigating #13583, because empty and notEmpty filters are passed like so to the search endpoint:

// request rows where `someKey` is empty
{ empty: { someKey: null } }
// request rows where `someKey` is not empty
{ notEmpty: { someKey: null } }

The allFiltersEmpty variable in packages/backend-core/src/db/lucene.ts does not get set to false when these are the only filters in the search, a check prevents it.

To fix this, I'm making certain allFiltersEmpty is set to false when these filters are present, and I have added new tests to ensure this behaviour does not regress.

Addresses

Launchcontrol

Fix some confusing behaviour when you perform a search that only contains an empty or notEmpty filter, and you have set the "when filter empty" to "none". Previously, "when filter empty: none" could cause searches to return no rows when there were filters present. This is no longer the case.

@samwho samwho added the firestorm Data/Infra/Revenue Team label May 7, 2024
@samwho samwho requested a review from a team as a code owner May 7, 2024 15:51
@samwho samwho requested review from mike12345567 and removed request for a team May 7, 2024 15:51
@samwho samwho merged commit 93661f6 into master May 8, 2024
10 checks passed
@samwho samwho deleted the fix-empty-search branch May 8, 2024 09:12
@mike12345567 mike12345567 restored the fix-empty-search branch May 8, 2024 09:12
@mike12345567 mike12345567 deleted the fix-empty-search branch May 8, 2024 09:12
@github-actions github-actions bot locked and limited conversation to collaborators May 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
firestorm Data/Infra/Revenue Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants