Sunday 21 December 2014

AEM/CQ & Solr integration

Adobe AEM/CQ & Solr integration

Solr is used as one of the major open source search engine in many applications.
Solr can also be used with Adobe AEM/CQ to index page data. This is more helpful to avoid burdening the query browser.

Some sites also use Solr to get specific functionality. In such cases Solr search for he application will be restricted to a set of defined functionality like fetching a set of contents, some of the related items etc.

If we implement the Solr in an efficient way, the search will be extremely fast.

Steps while indexing data to Solr.
When Solr is used as part of AEM website system, all the page data will not be indexed to Solr. So to index required data, we can create custom transport handlers in CQ to insert data.

In transport handlers we should define what are all the page properties are pushed to index. Only this items are going to Solr. While doing search in Solr through query, the results appears faster.

When the data gets indexed?

When ever the page content gets modified by Author, the new data should be transferred to Solr too. We need to have a custom transport handler created which triggers replication when a page is published.So the transport handler ensure when there is a publish, the respective page is gone through custom agent and its properties are collected and pushed to System. The properties are collected and create a Solr document out of the properties using 'solrj' bundle. This document can be committed to Solr with help of solrj.

How the result is retrieved.
Solr provides search results in many formats like text, xml,JSON. Majority of the application now uses JSON as retrieval format, but it is totally on the convenience of the coder. When the system invokes the solr with query, it returns the results as the format we specified during Solr configuration. These data can be interpreted to display the results in a AEM(CQ) page.

How to delete the data from publish.
The above said custom handler will ensure whenever there is an un-publish, the data will be deleted from Solr too, thus the results are removed from the search.

We are coming up with detailed explanation of above each tasks.
Subscribe our blog for more updates about AEM CQ - Solr integrations.

No comments:

Post a Comment