fjtirado commented on code in PR #2196:
URL: 
https://github.com/apache/incubator-kie-kogito-apps/pull/2196#discussion_r1970495439


##########
data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java:
##########
@@ -205,10 +228,22 @@ protected <K, T> List<T> 
executeAdvancedQueryForCache(StorageFetcher<K, T> cache
                 query.offset(offset);
             }
         }
-
         return query.execute();
     }
 
+    protected <K, T> long executeCount(StorageFetcher<K, T> cache, 
DataFetchingEnvironment env) {
+        return setupQuery(cache, env).count();
+    }
+
+    private <K, T> Query<T> setupQuery(StorageFetcher<K, T> cache, 
DataFetchingEnvironment env) {
+        Objects.requireNonNull(cache, "Cache not found");
+        String inputTypeName = ((GraphQLNamedType) 
env.getFieldDefinition().getArgument("where").getType()).getName();
+        Query<T> query = cache.query();
+        Map<String, Object> where = env.getArgument("where");
+        
query.filter(GraphQLQueryParserRegistry.get().getParser(inputTypeName).apply(where));

Review Comment:
   I think the query object cannot be cached. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to