Expand my Community achievements bar.

SOLVED

Index jcr:content/cq:lastReplicationAction - Not a valid JCR Name

Avatar

Level 3

I am trying to create custom index on jcr:content/cq:lastReplicationAction on AEM but for some reason it complained about "Not A Valid JCR Name"

 

wenwang1_0-1706059080373.png

 

 

Am I missing something here?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 7

@aemUser2345 
For Property Index in OakIndexDefinition,
You need not specify path of the property, just go with all properties in propertyNames field (i.e. cq:lastReplicationAction)
And then you can specify node type for which this index is applicable in declaringNodeTypes field (i.e. cq:PageContent)
These should work.

For more info on above properties:
Checkout documentation : https://jackrabbit.apache.org/oak/docs/query/indexing.html

And these relevant references :

  1.  https://myaemlearnings.blogspot.com/2020/05/property-index-in-aem-index-properties.html
  2. https://experienceleague.adobe.com/docs/experience-manager-65/content/implementing/deploying/deployi...
  3. https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/property-index-in-aem-inde...

 

View solution in original post

4 Replies

Avatar

Community Advisor

When creating a property index in AEM, you typically only need to specify the property name itself, without the full node path. This is because property indexes focus on indexing individual property values within nodes, not the entire node structure.

Avatar

Community Advisor

Hi @aemUser2345 
It seems like you are encountering an issue with creating a custom index on jcr:content/cq:lastReplicationAction.The error message "Not a Valid JCR Name" suggests that there might be an issue with the syntax or format of the index definition
Make sure that the name attribute in the <cq:lastReplicationAction> property definition adheres to the rules for valid JCR names.

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://www.apache.org/jackrabbit/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="sling:OsgiConfig"
    reindex="true">

    <!-- Define the custom index -->
    <index
        jcr:primaryType="oak:QueryIndexDefinition"
        async="async"
        compatVersion="{Long}2"
        evaluatePathRestrictions="{Boolean}false"
        type="lucene">
        
        <!-- Specify the index rules -->
        <indexRules jcr:primaryType="nt:unstructured">
            <nt:base
                jcr:primaryType="nt:unstructured">
                <properties
                    jcr:primaryType="nt:unstructured">
                    <cq:lastReplicationAction
                        jcr:primaryType="nt:unstructured"
                        name="cq:lastReplicationAction"
                        type="String"/>
                </properties>
            </nt:base>
        </indexRules>
    </index>
</jcr:root>

 



Avatar

Correct answer by
Level 7

@aemUser2345 
For Property Index in OakIndexDefinition,
You need not specify path of the property, just go with all properties in propertyNames field (i.e. cq:lastReplicationAction)
And then you can specify node type for which this index is applicable in declaringNodeTypes field (i.e. cq:PageContent)
These should work.

For more info on above properties:
Checkout documentation : https://jackrabbit.apache.org/oak/docs/query/indexing.html

And these relevant references :

  1.  https://myaemlearnings.blogspot.com/2020/05/property-index-in-aem-index-properties.html
  2. https://experienceleague.adobe.com/docs/experience-manager-65/content/implementing/deploying/deployi...
  3. https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/property-index-in-aem-inde...

 

Avatar

Administrator

@aemUser2345 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni