Expand my Community achievements bar.

Issue while fetching relationships of users in AEM

Avatar

Level 3

We did a code migration from cq5.6 to AEM 6.1. But after migration we are getting bellow warning.

13.05.2016 04:47:08.629 *WARN* [134.113.238.3 [1463129228000] GET /content/myproject/en/groups/MY-GROUP/en.html HTTP/1.1] 
org.apache.jackrabbit.oak.spi.query.Cursors$TraversingCursor Traversed 907000 nodes with filter Filter(query=select d.[jcr:path] 
as [jcr:path], d.[jcr:score] as [jcr:score], d.* from [nt:base] as a inner join [nt:base] as b on ischildnode(b, a) inner join
 [nt:base] as c on ischildnode(c, b) inner join [nt:base] as d on isdescendantnode(d, c) where name(a) = 'social' 
 and isdescendantnode(a, '/home') and name(b) = 'relationships' and name(c) = 'member' and d.[id] = 'somegroup-users' /* xpath:
 /jcr:root/home//social/relationships/member//*[@id='somegroup-users'] */, path=/home//*); 
consider creating an index or changing the query

Below mentioned is the code.

SocialGraph socialGraph = resourceResolver.adaptTo(SocialGraph.class);
GraphNode currentUser = socialGraph.getNode("somegroup-users");
for (Relationship r: currentUser.getRelationships("BOTH", "following")) { // We are getting warning for this line
                // ..
                ..//

Now this component is not getting loaded.We are getting connection timeout error. 

We are not able to understand where the issue is. Do we need to install any hotfix for this? Please advice.

7 Replies

Avatar

Employee

Hi,

based on the warning it appears that there is no index[0] for the query that is being generated from your code[0]. If this is product code, then raise a daycare ticket or create your own index. Have you installed SP1?

Regards,

Opkar

[0] https://docs.adobe.com/docs/en/aem/6-1/deploy/platform/queries-and-indexing.html

Avatar

Level 3

Hi Opkar,

Thank you for your reply.

When I googled the warning, I got a similar post telling "The warning message "Traversed 333000 nodes using index cq:tags with filter" actually means that there is an existing "property" index, but it itself is too large, and a lucene index should be used instead. The common case of querying something for which there is no index at all will look slightly different - something like "Traversed 1000 nodes without index". So I feel like indexing is not an issue here.

We didn't install SP1. 

Avatar

Level 3

Yes we have indexed "jcr:path,jcr:score,nt:base" properties. But still we are able to see this warning in logs.

Avatar

Employee Advisor

Hi,

obviously you are using the index, but at the same you use functions which cause a index scan (they need to perform the function on every index entry to check if the condition is met).

Can you post your query?

Jörg

Avatar

Level 3

Hi,

We are not using any query in our code, below mentioned is the code.

SocialGraph socialGraph = resourceResolver.adaptTo(SocialGraph.class);
GraphNode currentUser = socialGraph.getNode("somegroup-users");
for (Relationship r: currentUser.getRelationships("BOTH", "following")) { // We are getting warning for this line
                // ..
                ..//

Avatar

Employee Advisor

Hi,

please raise a Daycare ticket, include the complete list of installed bundles and their versions (available via webconsole) and attach a dump of your oak index definitions (hostname/oak:index.-1.json). Obviously there is room for improvement.

(Have you made sure, that the API you're using is not deprecated? In the social area there have been some changes not only in the API, but also in some more general changes in the way it is designed.)

Jörg