Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Creating a property oak index at the project level

Avatar

Level 2

Hello Everyone,

I am trying to create a property index at the project level where the path would be content/project/oak:index

The same index if kept in the default oak:index folder gets picked up for all the queries. But if i have it in the project folder it doesnt.

Any idea why?

Thank you so much!

9 Replies

Avatar

Level 10

Could you share the index definition? It should work at your project level /content/project/oak:index

Avatar

Level 10

OAK index has specific standards to make it work. I recommend that you watch this GEMS session.

Adobe Experience Manager Help | Oak Lucene Indexes

Avatar

Level 2

We have Lucene indexes at the same level and they are working fine. This one is a single property index.

Avatar

Level 2

Here is the index xml

<oak:index jcr:primaryType="nt:unstructured">

        <email

            jcr:primaryType="oak:QueryIndexDefinition"

            info="Oak Index used for searching by email"

            propertyNames="{Name}[email]"

            reindex="{Boolean}false"

            reindexCount="{Long}3"

            type="property"

            unique="{Boolean}false"/>

    </oak:index>

Avatar

Level 10

Below are the screenshots. What message do you get in your case? Does it generate the stats?

1675696_pastedImage_0.png

1675763_pastedImage_1.png

1675764_pastedImage_2.png

1675765_pastedImage_3.png

*INFO* [qtp175495745-1958] org.apache.jackrabbit.oak.plugins.index.IndexUpdate Indexing report

    - /content/we-retail/oak:index/myNodeApps*(4)

Avatar

Employee Advisor

You need to limit the query explicitly to that folder (as outlined in the example of gauravd83019631​).

Your approach is possible but In most cases even project indexes are dropped into /oak:index.

Avatar

Level 2

i am using

select * from [nt:base] as a where isdescendantnode(a, '/content/project') and a.[email]='test@test.com'

but it says

1678176_pastedImage_0.png

Avatar

Level 2

It does generate the stats but says that no indexes are used, this is a traversal query.

Avatar

Level 10

Did you get a chance to check screenshots posted above?

1) Check if the index is picked up and no issues with syntax -

http://localhost:4502/libs/granite/operations/content/diagnosistools/indexManager.html

2) Add 'nodeTypeListDefined' and 'declaringNodeTypes', if you want to restrict it to certain nodes for lower cost

3) Check if index stats are getting generated, perform reindex and check the logs -

http://localhost:4502/system/console/jmx/org.apache.jackrabbit.oak%3Aname%3DProperty+Index+statistic...

4) Check the permissions on this path /content/project/oak:index - the service users should have read permissions, if not already available.

Refer - Jackrabbit Oak – The Property Index

  • declaringNodeTypes (Name, multi-valued): the index only applies to a certain node type.
  • includedPaths (String, multi-valued): the paths that are included (‘/’ if not set). Since Oak version 1.4 (OAK-3263). The index is only used if the query has a path restriction that is not excluded, and part of the included paths.