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

package exact example for custom index in aem cloud

Avatar

Level 3

Hello,
I am struggling with the format required to deploy a custom Lucene index in AEM cloud as described here
https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/operations/indexing...

I understand it should be placed in ui.apps/src/main/content/jcr_root

 

I was also reading this
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-as-cloud-service-custo...

but a complete package example would be great.
Thanks!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@AndreaB69 

Make an entry in ui.apps.structure module's filevault-package-maven-plugin

Vijayalakshmi_S_0-1648047468520.png

 

View solution in original post

19 Replies

Avatar

Employee Advisor

Hi @AndreaB69 

 

Create a package of let us say /oak:index/cqPageLucene using packmgr.

Then unpackage it and copy the folder _oak_index and paste in in your codes folder parallel to apps.

Now go in the content.xml and remove unwanted indexes and just keep cqPageLucene. 

Update the name of cqPageLucene to cqPageLucene-custom-1 (Keep upating the number as you keep adding changes) and add your changes.

Add in your apps filter.xml

<filter root="/oak:index">
<include pattern="/oak:index/cqPageLucene-custom-.*(/.*)?"/>
</filter>

 

Hope this helps!!!!

Avatar

Level 3

Hello,

I still get

[ERROR] ValidationViolation: "jackrabbit-packagetype: Package of type 'APPLICATION' is not supposed to contain includes/excludes below any of its filters!", filePath=META-INF\vault\filter.xml

even if I applied the suggested conf 
in 
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-as-cloud-service-custo...

in ui.apps pom.xml

Is there any other suggestion on this?
Thanks

Andrea

Avatar

Administrator

@Anish-Sinha @lukasz-m @Nitin_laad Request your help with this Question. 



Kautuk Sahni

Avatar

Community Advisor

@AndreaB69 

Please add the below(allowIndexDefinitions) in filevault-package-maven-plugin in either main/pom.xml or in apps/pom.xml

Vijayalakshmi_S_0-1648042771656.png

 

If you still face issues with validation, request you to share the filevault-package-maven-plugin version that you are using along with validation error trace

Avatar

Level 3

hello , This is the relevant part in my ui.apps  pom.xml

 

           <!-- ====================================================================== -->
            <!-- V A U L T   P A C K A G E   P L U G I N S                              -->
            <!-- ====================================================================== -->
            <plugin>
                <groupId>org.apache.jackrabbit</groupId>
                <artifactId>filevault-package-maven-plugin</artifactId>
                <extensions>true</extensions>
                <version>1.1.6</version>
                <configuration>
                    <allowIndexDefinitions>true</allowIndexDefinitions>
                    <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
                    <validatorsSettings>
                        <jackrabbit-packagetype>
                            <options>
                                <immutableRootNodeNames>apps,libs,oak:index</immutableRootNodeNames>
                            </options>
                        </jackrabbit-packagetype>
                        <jackrabbit-nodetypes>
                            <options>
                                <!-- use the nodetypes and namespaces from the aem-nodetypes.jar provided in the plugin dependencies -->
                                <cnds>tccl:aem.cnd</cnds>
                            </options>
                        </jackrabbit-nodetypes>
                    </validatorsSettings>
                    <properties>
                        <cloudManagerTarget>none</cloudManagerTarget>                       
                    </properties>
                    <group>com.mycomp.myapp</group>
                    <name>myapp.ui.apps</name>
                    <packageType>application</packageType>
                    <repositoryStructurePackages>
                        <repositoryStructurePackage>
                            <groupId>com.mycomp.myapp</groupId>
                            <artifactId>myapp.ui.apps.structure</artifactId>
                        </repositoryStructurePackage>
                    </repositoryStructurePackages>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.jackrabbit.vault</groupId>
                        <artifactId>vault-validation</artifactId>
                        <version>3.5.6</version>
                    </dependency>
                    <dependency>
                        <groupId>biz.netcentric.aem</groupId>
                        <artifactId>aem-nodetypes</artifactId>
                        <version>6.5.7.0</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>com.day.jcr.vault</groupId>
                <artifactId>content-package-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <verbose>true</verbose>
                    <failOnError>true</failOnError>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.sling</groupId>
                <artifactId>htl-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>validate-htl-scripts</id>
                        <goals>
                            <goal>validate</goal>
                        </goals>
                        <phase>generate-sources</phase>
                        <configuration>
                            <generateJavaClasses>true</generateJavaClasses>
                            <generatedJavaClassesPrefix>org.apache.sling.scripting.sightly</generatedJavaClassesPrefix>
                            <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                            <allowedExpressionOptions>
                                <allowedExpressionOption>cssClassName</allowedExpressionOption>
                                <allowedExpressionOption>decoration</allowedExpressionOption>
                                <allowedExpressionOption>decorationTagName</allowedExpressionOption>
                                <allowedExpressionOption>wcmmode</allowedExpressionOption>
                            </allowedExpressionOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

 

 

the error I get is

[ERROR] ValidationViolation: "jackrabbit-packagetype: Package of type 'APPLICATION' is not supposed to contain includes/excludes below any of its filters!", filePath=META-INF\vault\filter.xml
[WARNING] ValidationViolation: "jackrabbit-filter: Found orphaned filter entries: includes [regex: /oak:index/cqPageLucene-custom-.*(/.*)?] below root '/oak:index'"

Thanks!
Andrea

Avatar

Community Advisor

Thanks for sharing the plugin config details.

Update the filter.xml to directly locate the desired index path in the root as opposed to include/exclude pattern 

Example :  <filter root="/oak:index/cqPageLucene-custom-1"/>

Outside this, cross verify the latest version of cqPageLucene in cloud service instance in which case the naming convention differs. (cqPageLucene-x-custom-y)

Avatar

Level 3

Hi,
modified as per your suggestion but still:

[ERROR] ValidationViolation: "jackrabbit-filter: Filter root's ancestor '/oak:index' is not covered by any of the specified dependencies nor a valid root.", filePath=META-INF\vault\filter.xml
[WARNING] ValidationViolation: "jackrabbit-filter: Found orphaned filter entries: entry with root '/oak:index/cqPageLucene-custom-1'"

please note we did not deploy yet to cloud since local validation in compiling fails...

Thanks

a.

Avatar

Correct answer by
Community Advisor

@AndreaB69 

Make an entry in ui.apps.structure module's filevault-package-maven-plugin

Vijayalakshmi_S_0-1648047468520.png

 

Avatar

Level 3

adding

<filters>
<filter><root>/apps</root></filter>
<filter><root>/oak:index</root></filter>
</filters>

in ui.apps pom.xml
did work!

Thanks
will try a deploy to cloud shortly

 

Avatar

Community Advisor

Before deploying to cloud, cross check you are amending the index definition on top of the latest from cloud service instance with respective naming convention. (Ignore, if this is already taken care)

Also, add below entry in <properties> in ui.apps module's filevault-package-maven-plugin. 

Vijayalakshmi_S_0-1648048667937.png

 

Avatar

Level 3

quick update:
I managed to deploy to SDK with custom index in
ui.apps/src/main/content/jcr_root/_oak_index/.content.xml

and adding
<filter root="/oak:index/mycomp.myproject-1-custom-1" />

 

ui.apps pom.xml has to be mended for new validator

I decided not to customize existing cqPage but create a new custom one

will test on cloud shortly

Avatar

Level 3

Hi,
this is it

<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/myapp/clientlibs"/>
<filter root="/apps/myapp/components"/>
<filter root="/apps/myapp/i18n"/>
<filter root="/oak:index/cqPageLucene-custom-1"/>
</workspaceFilter>

Avatar

Employee Advisor

Rather than adding 

 

<filter root="/oak:index/cqPageLucene-custom-1"/>

Add below as it will help as you will be making changes in future and at that time there is no need to update filter.xml, you just need to change index

<filter root="/oak:index/cqPageLucene-custom-.*(/.*)?"/>

Hope this helps!!

Avatar

Level 2

Hi Bimmi, i followed your tips above and it works locally, the only issue outstanding is i can't deploy to the cloud, it says something like unresolved dependencies, see attached picGreenshot 2022-05-16 18.11.26.png

however once i remove the changes related to indexes, it deploys fine

i am not sure what is causing it, can you help me check?

Avatar

Level 2

Thanks Bimmi, is there any chance that the configuration setting done for indexes might clash with the settings for netcentric acl tool?

 

the fact that once i removed the changes for enabling my custom index, the error goes away, that seems to me that something in the indexes configuration is causing the deployment error