-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
GraphQL error when filer on field that exists in two or more more types #17261
Comments
I would love to see the generated SQL to understand what went wrong. It's definitely looking at the wrong table, maybe it's just missing a predicate on the index type. |
We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues). This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here. |
I think this happens, because the Line 47 in 10c4319
This needs to change, also how the aliases are used in the OrchardCore/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/ContentItemsFieldType.cs Line 156 in 10c4319
@mdameer I think you built this functionality, can you have a look? |
For completeness, here is the generated SQL for the following query:
For numberType, which uses the wrong index: SELECT [Document].* FROM [Document]
INNER JOIN (
SELECT [Document].[Id], ContentItemIndex_a1.[CreatedUtc] AS order_1 FROM [Document]
INNER JOIN [ContentItemIndex] AS ContentItemIndex_a1 ON ContentItemIndex_a1.[DocumentId] = [Document].[Id]
INNER JOIN [TextFieldIndex] AS TextFieldIndex_a1 ON TextFieldIndex_a1.[DocumentId] = [Document].[Id]
WHERE [Document].[Type] = @Type AND ((ContentItemIndex_a1.[Published] = @p1) AND (ContentItemIndex_a1.[ContentType] = @p2) AND (([Text] = @x1)))
GROUP BY [Document].[Id] ORDER BY order_1 DESC LIMIT 100
) AS IndexQuery ON IndexQuery.[Id] = [Document].[Id] ORDER BY order_1 DESC For the stringType: SELECT [Document].* FROM [Document]
INNER JOIN (
SELECT [Document].[Id], ContentItemIndex_a1.[CreatedUtc] AS order_1 FROM [Document]
INNER JOIN [ContentItemIndex] AS ContentItemIndex_a1 ON ContentItemIndex_a1.[DocumentId] = [Document].[Id]
INNER JOIN [TextFieldIndex] AS TextFieldIndex_a1 ON TextFieldIndex_a1.[DocumentId] = [Document].[Id]
WHERE [Document].[Type] = @Type AND ((ContentItemIndex_a1.[Published] = @p1) AND (ContentItemIndex_a1.[ContentType] = @p2) AND (([Text] = @x1)))
GROUP BY [Document].[Id] ORDER BY order_1 DESC LIMIT 100
) AS IndexQuery ON IndexQuery.[Id] = [Document].[Id] ORDER BY order_1 DESC Additionally, the table aliases are not used at all. |
Describe the bug
When cteate two ContentTypes with field that named similar but with different type, GraphQL throws error when filter by this field.
Orchard Core version
2.1.0
To Reproduce
Logs and screenshots
When only "NumberType" created
When "NumberType" and "StringType" created
The text was updated successfully, but these errors were encountered: