How to create a index for a query in AEM6.3 with sp2 | Community
Skip to main content
srinivas_chann1
Level 7
April 8, 2020
Solved

How to create a index for a query in AEM6.3 with sp2

  • April 8, 2020
  • 1 reply
  • 4380 views

Hi ,

 

We were executing a query with a property is not null in the logs we found that

it is showing it traversed 2000 nodes and suggesting "consider creating an index or changing the query"

 

Could you please suggest as how could i go with creating an index for this 

 

Thanks

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 sunjot16

You can create an index of your query on the Oak Index Definition Generator:

https://oakutils.appspot.com/generate/index

 

Generating custom indexes on queries:

https://helpx.adobe.com/experience-manager/kb/create-custom-oak-index.html

 

 The following documents can help with Oak Queries & Indexing, as well as following the Best Practices to create efficient indexes:

https://helpx.adobe.com/experience-manager/6-3/sites/deploying/using/queries-and-indexing.html

https://helpx.adobe.com/experience-manager/6-3/sites/deploying/using/best-practices-for-queries-and-indexing.html#TipsforCreatingEfficientIndexes

1 reply

sunjot16
Adobe Employee
sunjot16Adobe EmployeeAccepted solution
Adobe Employee
April 8, 2020

You can create an index of your query on the Oak Index Definition Generator:

https://oakutils.appspot.com/generate/index

 

Generating custom indexes on queries:

https://helpx.adobe.com/experience-manager/kb/create-custom-oak-index.html

 

 The following documents can help with Oak Queries & Indexing, as well as following the Best Practices to create efficient indexes:

https://helpx.adobe.com/experience-manager/6-3/sites/deploying/using/queries-and-indexing.html

https://helpx.adobe.com/experience-manager/6-3/sites/deploying/using/best-practices-for-queries-and-indexing.html#TipsforCreatingEfficientIndexes

srinivas_chann1
Level 7
April 10, 2020

Hi sunjot16,

Please provide inputs.

 

I was able to generate the query required using the https://oakutils.appspot.com/generate/index

 

Assume it generated  below

<?xml version="1.0" encoding="UTF-8"?><jcr:root xmlns:dam="http://www.day.com/dam/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">
<myIndex compatVersion="{Long}2" async="async" jcr:primaryType="oak:QueryIndexDefinition" evaluatePathRestrictions="{Boolean}true" type="lucene">
<indexRules jcr:primaryType="nt:unstructured">
<dam:Asset jcr:primaryType="nt:unstructured">
<properties jcr:primaryType="nt:unstructured">
<valid name="valid" propertyIndex="{Boolean}true" jcr:primaryType="nt:unstructured" notNullCheckEnabled="{Boolean}true"/>
<mimetype name="mimetype" analyzed="{Boolean}true" jcr:primaryType="nt:unstructured"/>
<lastModified name="jcr:content/metadata/jcr:lastModified" ordered="{Boolean}true" jcr:primaryType="nt:unstructured"/>
<status name="jcr:content/metadata/status" propertyIndex="{Boolean}true" jcr:primaryType="nt:unstructured"/>
</properties>
</dam:Asset>
</indexRules>
</myIndex>
</jcr:root>

 

1> Should i manually login as admin and create this  content structure under /oak:index   and myIndex  name could be anything i could name it to?

Is there a possibility that we can add this code and deploy through maven .If yes then what will be the procedure

 

2> After the creating the required structure .Where to see for data if it has been indexed or not. 

Under 

http://localhost:4502/libs/granite/operations/content/diagnosis/tool.html/granite_oakindexmanager I see some options already present that are they under /oak:index

If i select any and click re-index it says "indexing completed"  .But where to go and check manually  the index data . Will the index data be stored under any node which i could view?

 

3> So after creating the structure and on clicking on re-indexing  for the 1st time will my query start  picking  from the indexed data .

4> If any new content  pages(say newly added few pages) has been added which are related to the query, then  will the index be refreshed automatically or should we manually go this page http://localhost:4502/libs/granite/operations/content/diagnosis/tool.html/granite_oakindexmanager  and trigger a manual refresh. 

 

Thanks.