Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

AEM 6.3 Integration with SOLR

Avatar

Level 2

Hi,

Is there any documentation covering the steps to integrate SOLR with AEM 6.3 for we-retail content?

I seem to not find anything for AEM 6.3.

Thanks,

Madhur

12 Replies

Avatar

Level 10

We have an article on how to hook up AEM with SOLR here - this is for 6.4:

Scott's Digital Community: Integrating SOLR with Adobe Experience Manager 6.4

There is a video too that shows you it working. This is a component that can be applied to different AEM sites - including We Retail.

Also -- we have an ASk the AEM community Experts too on this subject:

Scott's Digital Community: [Webinar |November] AtACE Session: Enterprise Search Solution for AEM usi...

This article and webinar will get you up and running.

Avatar

Level 10

A difference between this 6.4 artilce and what you need to do with 6.3 is in 6.3 create the project using Maven 12 Archetype.

Scott's Digital Community: Creating an Adobe Experience Manager 6.3 Project using Adobe Maven Archet...

Once you setup the project and use the 6.3 UBER JAR (that you specify in the POM file)  - rest of the ARTICLE should apply. The JAVA backend code will not change.

Avatar

Level 2

Hi,

I followed the steps in the community article for 6.4 integration with SOLR

However, got stuck on this - this service is not available in configuration manager in AEM 6.3

AEM Solr Search - Solr Configuration Service

Avatar

Level 10

YOu are using the CODE in this article for a 6.3 AEM instance - is that correct?

Avatar

Level 10

could you share relevant logs/screenshots, bundle info?  Compare your pom.xml and library versions against the article.

Avatar

Level 2

I got this resolved & now able to locate AEM SOLR search configuration. The bundle after deployment was inactive due to conflict with on of the libraries. Now I update my pom.xml & redeployed the project is working fine.

Avatar

Level 2

I have reached to a point wherein I have configured the AEM SOLR Search Service Configuration with following parameters -

http://localhost:8983/solr

core name  - collection

But whenever I hit indexer - i'm getting 404 custom handler error.

I'm attaching screen shots for your references.

Unfortunately the logs aren't getting updated as well. Stuck here. ConfigValues.png

collection_solr.png

solrbundle.jpgcustomerror.jpg

Avatar

Level 2

getting this error while hitting the sling servlet -

15.02.2019 20:36:42.708 *ERROR* [Thread-54] com.day.cq.dam.core.impl.ui.preview.FolderPreviewUpdaterImpl error while executing folder thumbnail update job: /content/dam/AemSolr2/asset.jpg

java.lang.IllegalArgumentException: width or height <= 0

at com.day.image.Layer.init(Layer.java:3149)

at com.day.image.Layer.<init>(Layer.java:490)

at com.day.cq.dam.core.impl.ui.preview.FolderPreviewGenerator$FolderPreviewCreator.createPreview(FolderPreviewGenerator.java:292)

at com.day.cq.dam.core.impl.ui.preview.AssetDrivenFolderPreviewGenerator.generate(AssetDrivenFolderPreviewGenerator.java:231)

at com.day.cq.dam.core.impl.ui.preview.FolderPreviewUpdaterImpl.updateFolderThumbnail(FolderPreviewUpdaterImpl.java:116)

at com.day.cq.dam.core.impl.ui.preview.FolderPreviewUpdaterImpl.run(FolderPreviewUpdaterImpl.java:173)

at java.lang.Thread.run(Unknown Source)

15.02.2019 20:36:42.716 *INFO* [JobHandler: /etc/workflow/instances/server0/2019-02-15_1/update_asset_6:/content/dam/AemSolr2/asset.jpg/jcr:content/renditions/original] com.day.cq.dam.pim.impl.sourcing.upload.process.ProductAssetsUploadProcess payload path :/content/dam/AemSolr2/asset.jpg/jcr:content/renditions/original

15.02.2019 20:36:42.724 *WARN* [JobHandler: /etc/workflow/instances/server0/2019-02-15_1/update_asset_6:/content/dam/AemSolr2/asset.jpg/jcr:content/renditions/original] com.day.cq.dam.core.impl.process.SendTransientWorkflowCompletedEmailProcess Cannot send email, mail service unavailable. Please configure Gateway in OSGi Console

15.02.2019 20:36:50.000 *INFO* [CommitStats] CommitStats 17 commits by 3 users [70% workflow-process-service, 23% sling-event, 5% dam-update-service] from 4 locations [76% jobhandler:/etc/workflow/instances/server0/2019-02-15_1/..., 11% jobmanager:job.finishJob, 5% jobmanager:job-startJobs, 5% jobmanager:job.reschedule] (2 types [76% jobhandler, 23% jobmanager]) [CommitStats overhead was 4ms = 235.0us / commit]

15.02.2019 20:37:15.396 *WARN* [0:0:0:0:0:0:0:1 [1550243235394] GET /libs/cq/security/userinfo.json HTTP/1.1] com.adobe.granite.xss.impl.XSSFilterImpl Cannot use custom policies.

15.02.2019 20:37:22.014 *INFO* [0:0:0:0:0:0:0:1 [1550243242012] GET /bin/solr/push/pages HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource /bin/solr/push/pages not found

15.02.2019 20:42:31.756 *INFO* [oak-repository-executor-1] com.adobe.granite.repository Service [6980, [org.apache.jackrabbit.oak.api.jmx.SessionMBean]] ServiceEvent REGISTERED

15.02.2019 20:42:36.483 *INFO* [Apache Sling Resource Resolver Finalizer Thread] com.adobe.granite.repository Service [6980, [org.apache.jackrabbit.oak.api.jmx.SessionMBean]] ServiceEvent UNREGISTERING

My sling servlet code -

package com.adobe.aem.core.servlets;

import java.io.IOException;

import javax.servlet.Servlet;

import javax.servlet.ServletException;

import org.osgi.framework.Constants;

import org.apache.sling.api.servlets.HttpConstants;

import org.osgi.service.component.annotations.Component;

import org.osgi.service.component.annotations.Reference;

import org.apache.sling.api.SlingHttpServletRequest;

import org.apache.sling.api.SlingHttpServletResponse;

import org.apache.sling.api.servlets.SlingAllMethodsServlet;

import org.apache.sling.commons.json.JSONArray;

import org.apache.sling.commons.json.JSONException;

import org.apache.solr.client.solrj.SolrServerException;

import org.apache.solr.client.solrj.impl.HttpSolrClient;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

import org.osgi.service.component.annotations.Reference;

import com.adobe.aem.core.SolrSearchService;

import com.adobe.aem.core.SolrServerConfiguration;

/**

*

* This servlet acts as a bulk update to index content pages and assets to the

* configured Solr server

*

*/

@Component(service=Servlet.class,

        property={

                Constants.SERVICE_DESCRIPTION + "=Solr Index Servlet",

                "sling.servlet.methods=" + HttpConstants.METHOD_GET,

                "sling.servlet.paths="+ "/bin/solr/push/pages"

           })

public class IndexContentToSolr extends SlingAllMethodsServlet {

private static final long serialVersionUID = 1L;

private static final Logger LOG = LoggerFactory

.getLogger(IndexContentToSolr.class);

@Reference

SolrServerConfiguration solrConfigurationService;

@Reference

SolrSearchService solrSearchService;

@Override

protected void doGet(SlingHttpServletRequest request,

SlingHttpServletResponse response) throws ServletException,

IOException {

doPost(request, response);

}

@Override

protected void doPost(SlingHttpServletRequest request,

SlingHttpServletResponse response) throws ServletException,

IOException {

response.setContentType("text/html");

String indexType = request.getParameter("indexType");

final String protocol = solrConfigurationService.getSolrProtocol();

final String serverName = solrConfigurationService.getSolrServerName();

final String serverPort = solrConfigurationService.getSolrServerPort();

final String coreName = solrConfigurationService.getSolrCoreName();

final String pagesResourcePath = solrConfigurationService.getContentPagePath();

String URL = protocol + "://" + serverName + ":" + serverPort+ "/solr/" + coreName;

//Create an HTTPSolrClient instance

HttpSolrClient server = new HttpSolrClient(URL);

if (indexType.equalsIgnoreCase("indexpages")) {

try {

JSONArray indexPageData = solrSearchService.crawlContent(pagesResourcePath, "cq:PageContent");

boolean resultindexingPages = solrSearchService.indexPagesToSolr(indexPageData, server);

if (resultindexingPages == true) {

response.getWriter()

.write("<h3>Successfully indexed content pages to Solr server </h3>");

} else {

response.getWriter().write("<h3>Something went wrong</h3>");

}

} catch (Exception e) {

LOG.error("Exception due to", e);

response.getWriter()

.write("<h3>Something went wrong. Please make sure Solr server is configured properly in Felix</h3>");

}

} else {

response.getWriter().write("<h3>Something went wrong</h3>");

}

}

}

Avatar

Level 10

the logs say  'org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource /bin/solr/push/pages not found'

Is this servlet active/registered in console?

Check this for 'java.lang.IllegalArgumentException: width or height <= 0'

Issue while uploading multiple assets inside DAM

Avatar

Level 2

1692341_pastedImage_0.png

It is in satisfied state. How do I make them active.