-
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
Enable Graphql queries to support total when using Lucene queries #11159
Conversation
Regarding the |
What if when there are multiple content types?
|
@aminmohammadi05 have you try graphql ? |
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.
This is a quick review, please check the format in all the places
src/OrchardCore.Modules/OrchardCore.Lucene/GraphQL/LuceneQueryFieldTypeProvider.cs
Outdated
Show resolved
Hide resolved
@@ -149,7 +164,7 @@ private FieldType BuildSchemaBasedFieldType(LuceneQuery query, JToken querySchem | |||
JsonConvert.DeserializeObject<Dictionary<string, object>>(parameters) | |||
: new Dictionary<string, object>(); | |||
|
|||
var result = await queryManager.ExecuteQueryAsync(iquery, queryParameters); | |||
var result = (await queryManager.ExecuteQueryAsync(iquery, queryParameters)) as OrchardCore.Lucene.LuceneQueryResults; |
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.
you can do the LuceneQueryResults
casting in the return
@@ -185,14 +199,163 @@ private FieldType BuildContentTypeFieldType(ISchema schema, string contentType, | |||
var queryParameters = parameters != null ? | |||
JsonConvert.DeserializeObject<Dictionary<string, object>>(parameters) | |||
: new Dictionary<string, object>(); | |||
|
|||
var result = await queryManager.ExecuteQueryAsync(iquery, queryParameters); | |||
var result = (await queryManager.ExecuteQueryAsync(iquery, queryParameters)) as OrchardCore.Lucene.LuceneQueryResults; |
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.
Same as above
src/OrchardCore.Modules/OrchardCore.Lucene/GraphQL/LuceneQueryFieldTypeProvider.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Lucene/GraphQL/LuceneQueryFieldTypeProvider.cs
Outdated
Show resolved
Hide resolved
|
cuz , you haven't input the schema field |
How to do that? |
|
|
I noticed that this function was merged into the main branch yesterday |
Lucene query should not do what you said. It stores some types in a table containing many fields |
No problem, how can I query two types at the same time. As you said I can handle separating the result based on its type. |
have you try object type? https://docs.orchardcore.net/en/latest/docs/reference/modules/Queries/#graphql |
Yeah I saw that, I wonder how to query two types at the same time. As you see the document only shows one type: "BlogPost". Can you provide an example? |
Not ready , I'm trying to implement more flexible schema configuration, such as {
items: {"type":"Array","ofType":"Blog"},
total: {"type":"Integer"},
} |
I tried this one to return total records but it did not work. What else should I do to get the result? |
Looks like the code is not work ,Do you use my branch directly? |
No I downloaded it via Nuget package manager in Visual Studio 2022 3 months ago |
This feature only work on my branch... |
So how can I get total records without using you branch? cuz I am in the middle of development and feel it risky to change the Orchard |
You can directly use the WebAPI : https://docs.orchardcore.net/en/latest/docs/reference/modules/Queries/#breaking-changes |
Thanks a lot. |
I thought, is it possible to change the UI of LuceneQuery to add a checkbox, which can togdle the total field What do you think? |
This pull request has merge conflicts. Please resolve those before requesting a review. |
I think this would be useful, but only if you implement parity with the Elasticsearch queries too. @Skrypt could you please chime in here? |
Why not always have a |
Of course that would be best, but that would introduce a disruptive change. |
In addition, we have discussed quantity statistics implemented on SQL Query |
It seems that this pull request didn't really move for quite a while. Is this something you'd like to revisit any time soon or should we close? Please comment if you'd like to pick it up. |
Closing this pull request because it has been stale for very long. If you think this is still relevant, feel free to reopen it. |
Change the query schema to the following: add 'hasTotal' :true
#6939