Issues with Queries using sling:resource property | Community
Skip to main content
Deepikaa_Nagesh
Level 3
April 29, 2016
Solved

Issues with Queries using sling:resource property

  • April 29, 2016
  • 16 replies
  • 9241 views

hi,

We are using aem 6.1 with oak version 1.2.7.

We see lot of traversal warnings for queries which use sling:resource property. Mostly these queries have paths for assets. Not sure when exactly this query is triggered by AEM.

There is already OOB oak property index available for sling:resource property but still these queries give warnings.

Sample Query

13.04.2016 10:41:31.328 *WARN* [pool-11-thread-5-<main queue>(com/adobe/cq/collection/update/job)] org.apache.jackrabbit.oak.plugins.index.property.strategy.ContentMirrorStoreStrategy Traversed 10000 nodes (15345 index entries) using index slingResource with filter Filter(query=select [jcr:path], [jcr:score], * from [nt:unstructured] as a where [sling:resource] like '/content/dam/cxxc/yyy/xxx/yy/1860x1050-fm-D11C-330-370-410-450.png%' and isdescendantnode(a, '/content/dam') /* xpath: /jcr:root/content/dam//element(*, nt:unstructured)[jcr:like(@sling:resource, '/content/dam/cxxc/yyy/xxx/yy/1860x1050-fm-D11C-330-370-410-450.png%')] */, path=/content/dam//*, property=[sling:resource=[[/content/dam/cxxc/yyy/xxx/yy/1860x1050-fm-D11C-330-370-410-450.png.., ../content/dam/cxxc/yyy/xxx/yy/1860x1050-fm-D11C-330-370-410-450.pnh]]])

These warnings are causing performance issues in author.

Thanks,

Deepikaa

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by

Solution for this particular issue is to have lucene property index.Not sure why existing oak property index didnt work.We had to disable it and put in lucene property index as shown below

 

"slingResourceLucene": {

    "jcr:primaryType": "oak:QueryIndexDefinition",

    "compatVersion": 2,

    "type": "lucene",

    "async": "async",

    "reindex": false,

    "reindexCount": 1,

    "indexRules": {

      "jcr:primaryType": "nt:unstructured",

      "nt:unstructured": {

        "jcr:primaryType": "nt:unstructured",

        "properties": {

          "jcr:primaryType": "nt:unstructured",

          "slingResource": {

            "jcr:primaryType": "nt:unstructured",

            "propertyIndex": true,

            "name": "sling:resource"

            }

          }
        }

      }

    }

  }

16 replies

smacdonald2008
Level 10
April 29, 2016

If you have done OAK Indexing - that is the best way to improve performance when querying in AEM for 6.x. 

For those reading this thread and not aware of OAK indexing - see this GEMS session: 

http://dev.day.com/content/ddc/en/gems/oak-lucene-indexes.html

smacdonald2008
Level 10
April 29, 2016

Can you please provide the exact syntax of the query you are using. 

Deepikaa_Nagesh
Level 3
April 30, 2016

Hi Scott,

1.Regarding the query syntax - 

Actually our application doesn't trigger this query. I think AEM itself does it when we either search for an asset in cf or in dam,but i am not sure when this query is actually triggered.

I have already put up the warning that comes in error logs. I have just changed asset path to a dummy value.When i tried identifying slow running queries using qla.jar, I got lot of entries like this for different assets in dam.

  Query: /jcr:root/content/dam//element(*, nt:unstructured)
        [jcr:like(@sling:resource, '/content/dam/test/business/markets/country/en-gb/news/0/Sample0.PDF/subassets/page0.pdf%')]
  Longest: /jcr:root/content/dam//element(*, nt:unstructured)
        [jcr:like(@sling:resource, ''/content/dam/test/business/markets/country/en-gb/news/news/2016/Sample4.PDF/subassets/page1.pdf%')]
  10,000 nodes traversed; ran 1 times, max 10,000 nodes, 2,234 lines 

2.There is already oak property index available for this (given below) and i also see that query is using this index.May be should we use lucene property index or fine tune the existing index?

<slingResource
        jcr:primaryType="oak:QueryIndexDefinition"
        propertyNames="{Name}[sling:resource]"
        reindex="{Boolean}false"
        reindexCount="{Long}1"
        type="property"/>

Tuhin_Ghosh
Level 8
May 2, 2016

This looks like, the queries are getting triggered when you are searching digital assets in the AEM. Now one of the many causes might be the assets are heavy weight and while searching 10000 nodes should not be a big deal for AEM, still the weight of the assets might be playing a vital role here. 

What is the exact nature of your search, is it some search where the users are searching the website or this is some search which the developers and the content authors are doing. It looks like from your reply that you are experiencing the second scenario. In this case as Scott mentioned indexing is the way of optimizing a query so avoid performance issues.

Since this is not likely to affect the user experience I would not worry much about the warning much as long as its not wasting precious development and authoring time.

 

Thanks

Tuhin

Deepikaa_Nagesh
Level 3
May 3, 2016

Hi Tuhin,

This is not site search,this happens only in author instance. Our author severs are performing very slow and during our analysis we found these warnings popping up for nearly 2500 times in a day.

I think query is already using existing oak index ,i could see this phrase "using index slingResource " in the warning.

I tried re-indexing this index but still no visible results.

 

Thanks,

Deepikaa

Tuhin_Ghosh
Level 8
May 3, 2016

Hi Deepika,

To be honest, right now I am not able to determine the exact reason of this issue. I would recommend doing a offline compaction once on your servers and see if this helps. Though not a foolproof solution to your problem but it might help you.

Thanks

Tuhin 

Deepikaa_Nagesh
Level 3
May 4, 2016

Thanks  for the reply Tuhin.

Have raised day care ticket for this.

Tuhin_Ghosh
Level 8
May 4, 2016

Hi Deepika,

Kindly close this ticket then.

Thanks

Tuhin

May 5, 2016

I shall close this with solution provided so that others can refer it.

Also I am nt sure how exactly to close a question here.

Tuhin_Ghosh
Level 8
May 5, 2016
        You just need to mark the answer as correct and that should suffice. Thanks Tuhin