package exact example for custom index in aem cloud | Community
Skip to main content
AndreaB69
Level 3
March 23, 2022
Solved

package exact example for custom index in aem cloud

  • March 23, 2022
  • 3 replies
  • 8256 views

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

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-custom-oak-index/m-p/430669#M122694

but a complete package example would be great.
Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Vijayalakshmi_S

Can you share your ui.apps/.../filter.xml 


@andreab69 

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

 

3 replies

Adobe Employee
March 23, 2022

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!!!!

AndreaB69
AndreaB69Author
Level 3
March 23, 2022

Thanks! 
I will test shortly and update

kautuk_sahni
Community Manager
Community Manager
March 23, 2022

@anish-sinha @lukasz-m @nitin_laad Request your help with this Question. 

Kautuk Sahni
Vijayalakshmi_S
Level 10
March 23, 2022

@andreab69 

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

 

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

AndreaB69
AndreaB69Author
Level 3
March 23, 2022

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

Level 2
May 16, 2022

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!!


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 pic

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?