Expand my Community achievements bar.

SOLVED

aem6.5 Indexing on OOTB query for find and replace text

Avatar

Level 8

Hi ,

 

We are using AEM6.5 OOTB find and replace functionality ,but noticed in the logs that this is causing lot of nodes to traversed hence want to index this 

 

Would need help  based on below as what is the query sent for this so that based on the query could be indexed   using the below https://oakutils.appspot.com/generate/index

 

From logs:-

org.apache.jackrabbit.oak.plugins.index.Cursors$TraversingCursor Traversed 15000 nodes with filter Filter(query=select [jcr:path], [jcr:score], from [nt:base] as a where isdescendantnode(a, '/content/project/us/en') or jcr:like(fn:lower-case(@searchPath),'%lorems%'))] option(traversal ok) /, path=/content/project/us/en//*, property=[function*lower*@searchPath=[(%lorems%..], searchPath=[is not null]]); consider creating an index or changing the query

 

1> What is the OOTB query sent for this

To find a text in the page ,

Say the page /content/project/us/en had text "abc" and must be replaced with "test"

 

We are using OOTB suffixes like  find.json  for this

 

http://localhost:4502/content/project/us/en.find.json?_charset_=utf-8&f=abc&cs=false&wwo=false&cq_ck=1614580151256

 

2> What is the OOTB query sent for this

To replace:-

We are using OOTB suffixes like replace.html  for this

http://localhost:4502/content/project/us/en.replace.html

With post data as below:-

 

p: /content/project/us/en
_charset_: utf-8
:status: browser
s: /content/project/us/en
f: abc
r: test

 

 

 

 

Thanks

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @srinivas_chann1,

Create a logger configuration for the below mentioned classes(Debug) in Sling Log(http://localhost:4502/system/console/slinglog) and trigger find action.

org.apache.jackrabbit.oak.query
org.apache.jackrabbit.oak.query.QueryImpl
org.apache.jackrabbit.oak.query.SQL2Parser
org.apache.jackrabbit.oak.query.QueryEngineImpl

 

In particular,

  • org.apache.jackrabbit.oak.query.QueryEngineImpl will display information of xpath and sql2 query along the lines like "parsing xpath..", "xpath to sql2 conversion.." and "parsing sql2..."
  • org.apache.jackrabbit.oak.query.QueryImpl will then display cost calculation for the query.

Once you get the query from the logs, use Query Performance tool for further action. (Tools -> Diagnosis -> Query Performance -> Explain query)

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi @srinivas_chann1,

Create a logger configuration for the below mentioned classes(Debug) in Sling Log(http://localhost:4502/system/console/slinglog) and trigger find action.

org.apache.jackrabbit.oak.query
org.apache.jackrabbit.oak.query.QueryImpl
org.apache.jackrabbit.oak.query.SQL2Parser
org.apache.jackrabbit.oak.query.QueryEngineImpl

 

In particular,

  • org.apache.jackrabbit.oak.query.QueryEngineImpl will display information of xpath and sql2 query along the lines like "parsing xpath..", "xpath to sql2 conversion.." and "parsing sql2..."
  • org.apache.jackrabbit.oak.query.QueryImpl will then display cost calculation for the query.

Once you get the query from the logs, use Query Performance tool for further action. (Tools -> Diagnosis -> Query Performance -> Explain query)

Avatar

Level 8

Hi Vijayalakshmi_S,

 

I was able to capture logs using .find.json but for replace.html does not shown any query in logs .How to find what is the query for that

 

for http://localhost:4502/content/project/us/en.replace.html it is not showing any query in logs so what does this mean ,I need to looks any other packages in logs

 

Thanks

Avatar

Community Advisor

When "p" is passed in the request body for replace call, respective path's content resource is used for modifying/replacing logic, No query will be executed.

Only when "p" is not provided, query is executed. You can try the same.