Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

OAK Indexing | Custom Lucene index | AEM 6.3

Avatar

Level 2

I am working on optimizing a query by indexing so that it will not traverse through all the nodes. I have created an index definition with the help of Oak Index Definition Generator.

XML of the index definition :

<?xml version="1.0" encoding="UTF-8"?><jcr:root xmlns:nt="http://www.jcp.org/jcr/nt/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">

<nt:base jcr:primaryType="nt:unstructured">

<properties jcr:primaryType="nt:unstructured">

  <prop1 name="prop1" propertyIndex="{Boolean}true" jcr:primaryType="nt:unstructured" nullCheckEnabled="{Boolean}true"/>

  <prop2 name="prop2" ordered="{Boolean}true" jcr:primaryType="nt:unstructured"/>

  <prop3 name="prop3" propertyIndex="{Boolean}true" jcr:primaryType="nt:unstructured"/>

</properties>

</nt:base>

</indexRules>

</myIndex>

</jcr:root>

But it looks like there is something wrong with the configuration or the way I created the index definition. Could anyone help me out in configuring lucene index.

Below is the Xpath query that's been used to generate the index definition :

/jcr:root/content/xyz//*  [ (not(@prop1) or @prop1= 'false')  and ((@prop3= 'apps/components/pages/xyz' or @prop3= '/apps/mda/components/pages/abc'))  ] order by @prop2 descending

Please let me know if there's anything I am missing here.

5 Replies

Avatar

Level 2

Please let me know if I am creating the index definition at the appropriate place, below is the screenshot.

1416693_pastedImage_0.png

Avatar

Level 10

In the GEMS webinar i posted above - they go into detail. I recommend watching that as well.