It was mid of 2013, when my AEM/CQ5 journey has begun, and I was working on CQ5.5. Those days we didn’t have these many AEM blogs/videos and I had two hopes 1. Adobe Forum and 2. Guidance from senior CQ5 developers if I got stuck at any place.
But situation has been changed from last seven years, now I could see great AEM blogs/videos with detail information and these blogs/videos makes our lives easier.
Now I have multiple sources for learning like 1. AEM experience league communities 2. Input from Senior AEM architects/peers 3. AEM blogs/videos 4. Different groups
Now I would like to share one small incident from initial days, and it will help us to understand how AEM/CQ has evolved.
We were using CQ5’s Lucene search and it was my first project on CQ5, and we had one internal page named: Search Result page in CQ5 and this internal page was displaying in search result.
This internal page i.e. Search Result page should not be displayed in search results.
I was really struggling to resolve this issue and spent a good amount of time without any result.
Luckily, I got the contact of one CQ5 architect and he explained the approach and also shared the implementation steps.
Now let’s talk about those steps here -
Configuration required:
Need to add the custom paths in indexing_config.xml which is embedded into “Day CRX Sling — CRX Embedded Repository” bundle so that those added path will be excluded from indexing.
Below steps to be followed for modifying the indexing_config.xml
- Go to the Felix Web Console http://<host>:<port>/system/console and find the
“Day CRX Sling — CRX Embedded Repository com.day.crx.sling.server” bundle.
- Copy the id number of the bundle, this is the number on the left side.
- Open a command prompt.
- Change directories to the location where the bundle is stored (<id> is the id number from step 2):
cd crx-quickstart/launchpad/felix/bundle<id>
- Change directories to where the embedded jars are persisted using this command (your versionX.Y folder may have a higher version than 0.0):
cd version0.0/bundle.jar-embedded/
- Run this command to extract the indexing_config.xml file from the jar file (your crx-core jar may have a higher version than crx-core-2.4.23):
jar -xvf crx-core-2.4.23.jar com/day/crx/query/lucene/indexing_config.xml
- Add the below lines in the extracted file com/day/crx/query/lucene/indexing_config.xml
<! — Start: do not index the internal →
<index-rule nodeType=”nt:base” condition=”@excludefromindex=’true’”></index-rule>
<index-rule nodeType=”nt:base” condition=”ancestor::*/@excludefromindex=’true’”></index-rule>
<index-rule nodeType=”nt:base” condition=”@cq:template=’/apps/myapp/templates/searchresultpagetemplate’”></index-rule>
<index-rule nodeType=”nt:base” condition=”ancestor::*/@cq:template=’/apps/myapp/templates/searchresultpagetemplate’”></index-rule>
<! — End: do not index the internal →
Basically, via template of the search result page.
8. To update the xml file in the crx-core jar, run this command:
jar -uvf crx-core-2.4.23.jar com/day/crx/query/lucene/indexing_config.xml
9. Restart CQ for the changes to take effect.
10. After making the changes, you will need to rebuild the search index as per below steps
Rebuild the Search Index:
- Stop CQ/CRX
- Backup and delete these directories on the server:
crx-quickstart/repository/repository/index
crx-quickstart/repository/workspaces/crx.default/index
- Start CQ/CRX (IMPORTANT: Re-indexing can take anywhere from 1 hour to 48 hours depending on the amount of content you have in your repository. Make sure that you have coordinated with your users to have a proper outage window.)
Now if I want to achieve the same on AEM 6.5.X, then implementation is simpler, and we don’t need to stop and start AEM instance here -
Let’s assume that /content/we-retail/language-masters/en/search is the content path for search result page.
Step 1: Add the search result page path as excludedPaths at /oak:index/cqPageLucene as shown below -
Step 2: We need to make reindex property true as shown below and save -
Step 3: After successful re-idexing , the value of reindex property will become false and reindexCount will be increased. Now if I do search with keyword: search then this internal page won’t be available in search result.
Now it clearly shows how AEM has evolved and reduce the implementation effort and time.
[One small incident showed me how AEM has evolved and why do I love AEM]
by <Debal Das>
Overview
[Insert short description of blog here]
Q&A
Please use this thread to ask questions relating to this article