Highlighted

AEM 6.3 Integration with SOLR

Avatar

Avatar

madhurk64086364

Avatar

madhurk64086364

madhurk64086364

06-02-2019

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

Replies

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

06-02-2019

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.

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

06-02-2019

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.

Highlighted

Avatar

Avatar

madhurk64086364

Avatar

madhurk64086364

madhurk64086364

12-02-2019

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

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

12-02-2019

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

Highlighted

Avatar

Avatar

madhurk64086364

Avatar

madhurk64086364

madhurk64086364

12-02-2019

Yes. I'm using AEM 6.3

Highlighted

Avatar

Avatar

Gaurav-Behl

MVP

Total Posts

1.1K

Likes

226

Correct Answer

281

Avatar

Gaurav-Behl

MVP

Total Posts

1.1K

Likes

226

Correct Answer

281
Gaurav-Behl
MVP

12-02-2019

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

Highlighted

Avatar

Avatar

madhurk64086364

Avatar

madhurk64086364

madhurk64086364

12-02-2019

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.

Highlighted

Avatar

Avatar

madhurk64086364

Avatar

madhurk64086364

madhurk64086364

13-02-2019

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

Highlighted

Avatar

Avatar

madhurk64086364

Avatar

madhurk64086364

madhurk64086364

15-02-2019

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>");

}

}

}