Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

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

Avatar

Level 8

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 

 

Capture.PNG

Thanks

1 Accepted Solution

Avatar

Correct answer by
Employee

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-...

View solution in original post

4 Replies

Avatar

Correct answer by
Employee

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-...

Avatar

Level 8

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.

 

 

 

Avatar

Employee

@srinivas_chann1

 

1) Yes, you can login as an admin, and create the index in crx. Then, when you want to deploy it to other instances, you can either replicate to publish instances, and/or create package of that index and deploy them on other instances.

You can create a package and then include it in the maven build to deploy for auto installation. You can also make use of VLT tool: https://docs.adobe.com/content/help/en/experience-manager-64/developing/devtools/ht-vlttool.html

 

2) You can see all the index aggregates and properties in /oak:index/<index> in crx/de.

3) True. You can verify that by going to Explain Query tool and running your query there. It will show whether your index is being picked up or not. Explain Query Tool => https://helpx.adobe.com/ca/experience-manager/6-3/sites/administering/using/operations-dashboard.htm...

4) It all depends on how your index is created. If new content is added, but doesn't show up. I would recommend you to reindex the index to make it work.

 

 

Hope these help.