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

Duplicated results when multiple terms are selected in a content item #8732

Open
AndreaPiovanelli opened this issue Nov 3, 2023 · 0 comments
Milestone

Comments

@AndreaPiovanelli
Copy link
Contributor

AndreaPiovanelli commented Nov 3, 2023

https://github.com/OrchardCMS/Orchard/blob/03884cbd6431721ffe69b03c69ba672a1cb44dc1/src/Orchard.Web/Modules/Orchard.Projections/Services/ProjectionManager.cs#L155C2-L155C2

When applying a filter on the terms of a taxonomy, results are sometimes duplicated; this happens when a terms filter (HasTerms) is applied (in combination to other filters, e.g. a filter on content types) and a content item matches the filter for more than one term: in this situation, the resulting contentItems list contains multiple occurences of the same content item (specifically, one occurence for each term matching the filter).

Patch has to be applied here in ProjectionManager instead of Orchard.Taxonomies.Projections.TermsFilter.ApplyFilter function because, in the latter, query is not executed yet and, for this reason, duplicate content items cannot be removed.

Edit: after more digging, the issue is caused by the "random sorting", which disables the "select distinct" clause inside the "DefaultHqlQuery.ToHql" function called by the "HqlQuery.Slice" function.

@sebastienros sebastienros added this to the 1.10.x milestone Nov 9, 2023
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

No branches or pull requests

2 participants