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

#8232: Adding warnings when a Projection Query has an empty Filter Group #8813

Open
wants to merge 9 commits into
base: 1.10.x
Choose a base branch
from

Conversation

BenedekFarkas
Copy link
Member

Fixes #8232

@BenedekFarkas BenedekFarkas self-assigned this Nov 27, 2024
@BenedekFarkas BenedekFarkas linked an issue Nov 27, 2024 that may be closed by this pull request
Comment on lines 212 to 213
// Iterate over each filter group, but ignore empty ones, because they'd cause all content items to be returned.
foreach (var group in queryRecord.FilterGroups.Where(group => group.Filters.Count > 0)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only functional change, the rest is just code styling and comment rephrasing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am suggesting adding a limit filter instead (100, 500). And add a notification.

Copy link
Member Author

@BenedekFarkas BenedekFarkas Dec 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find a suitable way to apply such a limit due to how the query is constructed (there is no explicit limit filter) without hurting the abstractions. It is possible to intervene towards the end of the query evaluation when Slice is called (and apply a limit there), but that would mess up paging.
I added a notification instead, when a Query or a ProjectionPart is saved, IMO that's good enough.

@BenedekFarkas BenedekFarkas added this to the Orchard 1.10.4 milestone Dec 9, 2024
@BenedekFarkas BenedekFarkas changed the title #8232: Fixing that an empty Projection Query shouldn't list all content items #8232: Adding warnings when a Projection Query has an empty Filter Group Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Projections: Empty Query returns every content item
2 participants