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

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 5

@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 5

@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
The following has evaluated to null or missing: ==> liql("SELECT id, subject, body, depth, post_time, author.login, author.id, author.rank, metrics.views FROM messages WHERE topic.id = '${topicId}' AND is_solution = true").data.items[0] [in template "analytics-container" at line 82, column 31] ---- Tip: It's the final [] step that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign acceptedAnswer = liql("SELECT... [in template "analytics-container" at line 82, column 5] ----