Solr provides many powerful features widely adopted that it gives when performing searching all types of contents in AEM. Some sections are related to the previous article and refer specifically by clicking the link here if someone understands the configuration unclearly in AEM Project.
Between versions of Solr are much more not differ considerably, but the user still encourages install the latest version or stablest version. Click the link here to get all versions of Solr and version 6.6.6 may be proposed because the set of guidance on the home page Solr aims at this version. Other versions also support full of features with equally likely as Solr 6.6.6.
In several specific cases, the process of downloading or install with many manipulations cause some unexpected errors as "Java JDK not installed" To process the problem, visit www.oracle.com to get Java JDK (propose version 1.8) and set the JAVA_HOME path on the Windows environment system.
Undertake extract file zip after completely downloading, copy it to a specific location in PC(avoid set names which contain space).
Coming into the folder Solr, the file as format .exe does not exist to support conventionally launching Solr. Use the Command Prompt program to launch the line code below.
solr start -e cloud -noprompt
Ensure Solr working perfectly by closer examination through open the URL localhost:8983/solr/#/ in browsers. Port 8983 is the default of the Solr client, some predecessor or later versions have quite a bit differ considerably about start/home page.
There are many individual sections guiding features in Solr, it highly dependent requirement through analyzing. Visit the home page to get more details. Based on catching knowledge, the section shows off the way to create a new collection in Solr.
To get some basic fundamental knowledge about Solr then you can refer link following here. The next stuff is to create a new collection by using the web client. We will make the single search index called 'collection' used in this article. Follow instructions from minor steps below:
The approach way is correct, but a common error still appears"'Path must not end with / character." It causes by missing a field that needs to fill and named "config set:" The config setting includes a set of configurations to server analyze data from AEM hosting. Some files usually focus on solrconfig.xml and managed-schema.
What does the thing attract to focus attention on in this section? That the how to connect between Solr and AEM. To start progress on Solr, so ensure that AEM already starts with the established port is 4052. All links contain inside of the article work perfectly if almost everything initializes before. Tab the link here to access Adobe Experience Manager Web Console Configuration.
Coming into the next step; quick search box with the keyword "AEM Solr Search - Solr Configuration Service" and enter the following values:
Further explanation: localhost or specific IP by provider hosting, that allows connecting data or fetch data following its address, 8983 is a default port in Solr; In reality, many nodes configure many different ports. "/content/we-retail" is one of the ton content paths in AEM. The syntax shows AEM provides a declared path to Solr. The following illustration shows these values:
If one has focused on the previous article here and would not be hardly surprising with established in file MySimpleService.class. That leads to parameters defines in the class above and the AEM server, which is surely identical. If perform a comparative analysis with the previous article here and the result are completely identical. Some a differ manipulations causes wrong value while configuration and lead unexpected errors.
The issues that occur while deploying the project code to a local instance of AEM have varying degrees. That shows many discussions surrounding these issues and find the optimal solutions to reduce significant effects catch up the progress of the project.
For a typical example, try to build project AemSolr2 by the command line below. Somehow, every time perform the manipulation above generates automatically a file named AemSolr2.core-1.0-SNAPSHOT.jar.
mvn -PautoInstallPackage -Padobe-public -DskipTests clean install
From declaration in controllers of the project as IndexContentToSolr, DeleteIndexesFromSolr,... It automatically generates many routers, so let try to run the URL below.
http://localhost:4502/bin/solr/push/pages?indexType=indexpages
Because the project is built based on the Apache Sling framework, AEM has already designed a sling log to record all logs when encountering any errors. There are two ways to approach the file log of any project. A closer look below is the URL to open the sling log, and that assembles the log, which has the mode DEBUG or INFO for each particular project.
http://localhost:4502/system/console/slinglog
It would help if you changed the configuration from logger 'com.adobe.aem' from INFO to DEBUG. I will try to explain it thoroughly below.
Then you can click or double click on the link below. It navigates the page showing the full-text log while performing your URL above and getting the error 'Something went wrong.'
File : [/logs/project-AemSolr2.log] C:\Program Files\aem-sdk\author\crx-quickstart\logs\project-AemSolr2.log
Use shortcut Ctrl + F to open the quick search box in the browser and search with the keywords 'Error.' It quite a bit easy to find errors while performing the execution.
The error indicated that Bundle AemSolr2.core is NOT whitelisted lead the LoginException was forced appearing from inside AbstractSlingRepository2.java. To fix these issues, you need to add 'AemSolr2.core' to 'Apache Sling Login Admin Whitelist.' We need to come back 'Adobe Experience Manager Web Console Configuration.'
After reloading the link again, you can get the message 'Successfully indexed content pages to Solr server.' Some are sure curious about path '/bin/solr/push/pages'. The configuration of the URL comes from the class IndexContentToSolr.java.
Because a web framework is written as our source for the Java platform. That is Apache Sling. We will have a concept named "Sling log" to debug directly from AEM hosting. You can configure model "INFO" into "DEBUG" before deploying directly in AEM hosting. You can search the keyword 'org.apache.sling.commons.log.file' in the global scope of IDEA IntelliJ. Every configuration shows below.
Observe value 'info' was assigned in 'org.apache.sling.commons.log.level'. It means that each builds a file jar and uploads automatically to AEM hosting will configure login as INFO model. If you want to debug and then DEBUG for testing and deploy to the product and revert it to INFO. Encourage set level="debug" to support check bugs and logs from Apache Sling website framework.
LOG.debug("URL"+URL);
This page invokes the IndexContentToSolr sling servlet (you can see this servlet's source code in the OSGi section of part 1). If the index operation is successful, a message confirming the operation was successful appears, as shown in the previous illustration. To check, you can validate if the SOLR docs are created by going to the following URL:
http://localhost:8983/solr/#/collection/query
Select collection from the drop-down control and click the Execute Query button. If successful, you will see the result set that contains We Retail content.
Come here; we have two directions for more-in depth with Solr and AEM content hosting.
See you in articles that relate to AEM and Solr, Apache Sling website framework. Please leave a comment if you misunderstand or encountered any issues while following my article.
How to delete all data from Solr after indexing all contents from AEM hosting? Typically, along Part 1 and Part 2. We will crawl data from 'jcr:content' node with path '/content/we-retail.' Firstly, we access CRXDE|Lite again by clicking on the link below:
http://localhost:4502/crx/de/index.jsp#
We can inspect code for the browser and perform the code lines below to delete all Solr indexes. It happens and causes CSRF token when we perform requests directly without form or via HTTP client (Axios, ajax, ...).
To fix the issue with error 403 (Forbidden), we need to open the OSGi configuration.
We will perform a quick search with the keyword 'CSRF' in the browser to find the bundle 'Adobe Granite CSFR Filter.' We will remove the POST method as a temporary solution to run our script above for deleting all indexes.
Please press the button Save to update our configuration in Adobe Granite CSFR Filter. Then we can try our script below to perform action deleting all indexes.
let xhr = new XMLHttpRequest();
xhr.open('POST', "/bin/solr/delete/all/indexes", true);
xhr.send();
In reality, we are testing on it and then ignore the case for method POST. If someone testing with method GET or PUT. We will also do the same thing on the above that way. When you are working real project, we might not keep Adobe Granite CSRF Filter's default configuration. Try to perform some queries in the collection of Solr. We will get an empty result below.
In the next part 3, we will research query data in CRXDE|Lite in AEM and use the data to import the Solr.