Changing where excerpts come from in CQ5 search

Recently I’ve been working with Adobe CQ5 (AEM). Specifically I’ve been looking at how to change where the content or excerpt of search results comes from in the node structure.

The default property names of where excerpts are extracted from can be found in your local repository at the following URL

http://localhost:4502/system/console/configMgr/com.day.cq.search.impl.builder.QueryBuilderImpl

By default there are a number of properties defined. Typically these are “text” and “jcr:description”. In my case I needed to add a new property that can be used for content excerpts, this was a property called “bodyText”.

To do this automatically through a code release I added the following file into my code base that is getting bundled up. The file gets deployed to the following location

/apps/myapp/config/

with the filename

com.day.cq.search.impl.builder.QueryBuilderImpl.xml

in my code base.

The content of the file has the following in it


<?xml version="1.0" encoding="UTF-8"?>
 <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
 jcr:primaryType="sling:OsgiConfig"
 excerpt.properties="[bodyText,jcr:description,text]"
 />

Once deployed you should be able to see the content of your excerpt properties using the URL given above.

For more information have a look at the following link:

 

http://helpx.adobe.com/experience-manager/kb/RunModeDependentConfigAndInstall.html

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.