Hello,
I am posting this to seek advice from AEM experts.
I am attempting to upgrade an existing custom component to resolve an issue with an Unclosed Resource Resolver.
I created a custom system user, a custom Resource Resolver, and used it to create a custom session. I also conducted a querybuilder search, generated search results, and followed a process to display the data using the results.
In summary, I performed the following steps (please refer to the screenshot):
The issue I am facing is that there are no problems up to the querybuilder step, but the resultset is being assigned null. When I checked using the querybuilder, I confirmed that multiple records were indeed being found, but the resultset is still assigned null.
I would appreciate your feedback on what might be causing the issue in the above procedure.
Regards
=========================================
======================
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @keehwan1,
You may try something like below
Map<String, String> queryMap = new HashMap<>();
queryMap.put("path", rootPath);
queryMap.put("p.limit", "-1");
queryMap.put("p.offset", "0");
queryMap.put("type", NT_PAGE);
queryMap.put("1_property", "jcr:content/jcr:primaryType");
queryMap.put("1_property.value", "cq:PageContent");
Query query = queryBuilder.createQuery(PredicateGroup.create(queryMap), request.getResourceResolver().adaptTo(Session.class));
SearchResult result = query.getResult();
Thanks
What kind of permissions have you set to the service user?
Thank you for replying, @rk_pandian
The service user of 'writeService' have been set as read/create/delete all on content.
Hi @keehwan1,
You may try something like below
Map<String, String> queryMap = new HashMap<>();
queryMap.put("path", rootPath);
queryMap.put("p.limit", "-1");
queryMap.put("p.offset", "0");
queryMap.put("type", NT_PAGE);
queryMap.put("1_property", "jcr:content/jcr:primaryType");
queryMap.put("1_property.value", "cq:PageContent");
Query query = queryBuilder.createQuery(PredicateGroup.create(queryMap), request.getResourceResolver().adaptTo(Session.class));
SearchResult result = query.getResult();
Thanks
@keehwan1 Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies