-
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
Expose Content Fields Indexing via GraphQL for content field filtering #16092
Expose Content Fields Indexing via GraphQL for content field filtering #16092
Conversation
…nts for updated type, parts and fields
Thank you for submitting your first pull request, awesome! 🚀 If you haven't already, please take a moment to review our contribution guide. This guide provides helpful information to ensure your contribution aligns with our standards. A core team member will review your pull request. If you like Orchard Core, please star our repo and join our community channels |
@hyzx86 could you please review this? |
@coderabbitai review |
Actions PerformedReview triggered.
|
WalkthroughThe recent updates introduce the ability to filter content fields via GraphQL by leveraging content fields indexing. This enhancement includes new classes, methods, and event handlers to support dynamic content fields indexing and querying in GraphQL. The changes span multiple files, adding new functionalities and modifying existing ones to facilitate this feature. Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Out of diff range and nitpick comments (1)
src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs (1)
Line range hint
15-159
: Refactor to improve readability and reduce complexity in the methodBuild
.- public void Build(FieldType contentQuery, ContentTypeDefinition contentTypeDefinition, ContentItemType contentItemType) + public void Build(FieldType contentQuery, ContentTypeDefinition contentTypeDefinition, ContentItemType contentItemType) { // Refactor complex logic into smaller, more manageable methods. }
...OrchardCore.Modules/OrchardCore.ContentFields/GraphQL/Fields/ObjectGraphTypeFieldProvider.cs
Show resolved
Hide resolved
...OrchardCore.Modules/OrchardCore.ContentFields/GraphQL/Fields/ObjectGraphTypeFieldProvider.cs
Outdated
Show resolved
Hide resolved
...rchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentFieldsIndexAliasProvider.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing, have some minor questions for reference :)
You can include screenshots of the feature in the PR description, and then please update the documentation when the PR feature is finalized https://github.com/OrchardCMS/OrchardCore/blob/main/src/docs/releases/2.0.0.md
...rchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentFieldsIndexAliasProvider.cs
Show resolved
Hide resolved
...OrchardCore.Modules/OrchardCore.ContentFields/GraphQL/Fields/ObjectGraphTypeFieldProvider.cs
Outdated
Show resolved
Hide resolved
...rchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentFieldsIndexAliasProvider.cs
Outdated
Show resolved
Hide resolved
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Outdated
Show resolved
Hide resolved
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Outdated
Show resolved
Hide resolved
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Outdated
Show resolved
Hide resolved
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Outdated
Show resolved
Hide resolved
@mdameer please request a review from Tony once you done |
Please document this under https://docs.orchardcore.net/en/latest/reference/modules/SQLIndexing/#content-fields-indexing. |
It doesn't look like additional indexes have been added, this PR is just an enhancement to the graphql filtering functionality |
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Outdated
Show resolved
Hide resolved
Please do not close the conversation posed by the reviewer, as this will collapse subsequent comments. |
Hi @mdameer ,Before we continue, perhaps we can discuss this improvement here Personally, I think that adding all the fields directly as they are now would result in a schema structure that is too large and would look like too many fields in the schema viewer That's just my opinion, |
We can discuss this IMHO as @hyzx86 suggested |
That such indexes are available via GraphQL is a new thing, and that needs to be documented. |
Do you mean this? I think this is fine, we have a search feature there for a reason. |
This comment was marked as off-topic.
This comment was marked as off-topic.
OK, leaving that aside for now, this PR is good enough, let's discuss these in subsequent improvements。 |
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in the long run it would be better if IIndexAliasProvider.GetAliases
is asynchronous. This avoids using sync over async calls (GetAwaiter().GetResult()
).
src/OrchardCore.Modules/OrchardCore.ContentFields/GraphQL/Fields/ContentFieldsProvider.cs
Show resolved
Hide resolved
...rchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentFieldsIndexAliasProvider.cs
Outdated
Show resolved
Hide resolved
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Outdated
Show resolved
Hide resolved
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Outdated
Show resolved
Hide resolved
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Outdated
Show resolved
Hide resolved
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Outdated
Show resolved
Hide resolved
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Outdated
Show resolved
Hide resolved
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Outdated
Show resolved
Hide resolved
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Outdated
Show resolved
Hide resolved
...OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/DynamicContentTypeBuilder.cs
Show resolved
Hide resolved
…Async, use memory cache instead of concurrentdictionary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, thanks a lot.
@hishamco I believe this pull request is ready to be merged. Please let me know if any further changes are needed. |
@Piedone I will merge tonight if there's to add from your side |
I still have nothing to add here, go ahead :). |
Congratulations on your first PR merge! 🎉 Thank you for your contribution! We're looking forward to welcoming other contributions of yours in the future. @all-contributors please add @mdameer for code. |
Thanks a lot @mdameer for your effort and your first PR |
@github-actions[bot] I couldn't determine any contributions to add, did you specify any contributions? I've put up a pull request to add @mdameer! 🎉 |
I don't think the changes in |
Totally agree. We can address this in future updates to this area. |
Fix #12781
Enhancements:
Known Issues:
ListGraphType<StringGraphType>
will not be filterable due to thatListGraphType
is not derived fromScalarGraphType
, and when I tried to fix it by extracting the generic type and using it to expose the field, I found that it will not work as expectedDateTimeGraphType
is not working properly with the SQLite database, I don't think that it is related to this PR, more investigation is needed before determining if a new issue should be opened.