Understanding Apache Solr

The Apache Software Foundation created the open-source search engine known as Apache Solr. It offers strong search and indexing capabilities for webpages, databases, and other content and is built on top of the Apache Lucene framework. 

You can integrate your website with Solr if you use Drupal. The Drupal Search API module has a Solr backend provided by the Search API Solr Search module.

The Advantages of Using Apache Solr

  • The Apache Software Foundation created the open-source search engine known as Apache Solr. It offers strong search and indexing capabilities for webpages, databases, and other content and is built on top of the Apache Lucene framework. 
  • In addition to its near real-time indexing and searching capabilities, it enables Full-text searches that provide accurate results. Drupal Apache Solr indexing is not only quicker but it can also be combined and improved. 

Drupal Apache Solr provides Faceted navigation, which enables users to apply numerous filters to make it easier for them to sift through large amounts of data. Navigable items that are queryable are called facets.

Better control over your website’s search function and an interactive admin interface is provided by using Drupal Apache Solr.

Integrating Apache Solr with Drupal

  • Install Apache Solr
  • Install the Drupal Solr Module 
  • Configure Apache Solr with Drupal Module

1. How to Install Apache Solr?

  Step 1: Install JAVA : 

$sudo apt install openjdk-11-jdk
         $java -version

Source: Specbee

Step 2: Download Solr: https://solr.apache.org/downloads.html

Integrate Drupal With Apache Solr

Integrate Drupal With Apache Solr

Your system should now have Solr installed. The Solr service can be started and stopped, and its status can be checked with the following commands:

$sudo service solr stop
$sudo service solr start
$sudo service solr status

Source: Specbee

2. Setting up Drupal to Install the Search API Solr Module

After Drupal/search_api_solr:~4.1 has been required by the composer, enable the module. Navigate to Extension → Search → API Solr Search → Activate it

  3. Utilize the Drupal Search API Solr Module to configure Apache Solr.

Step 1: In Apache Solr, construct a core.

Integrate Drupal With Apache Solr

Source: Specbee

Step 2:  Create a Solr Server

You must set up a Solr server and index your Drupal website in this phase. To establish a server for Solr,

Click on Add Server after selecting Configuration -> Search And Metadata -> Search API.

Integrate Drupal With Apache Solr

Source: Specbee

You will be prompted with a form to fill out when you click the “Add server.” 

  •  Enter the name of the server.
  • Enable: The Enable check box must be checked. You cannot index the items if you don’t activate it.
  • Include a description of the server: An overview of the server in brief.

Integrate Drupal With Apache Solr

Source: Specbee

The Solr backend configuration comes next. In the form, click the CONFIGURE SOLR BACKEND button. The form elements are visible as depicted in the following image:

Integrate Drupal With Apache Solr

Select the HTTP protocol: https or Http, based on whether SSL is used by your server.

Solr host: localhost (please insert the IP address or hostname of the machine hosting your Solr server if it is not on this machine.)

Solr port: 8983 (the default port is here)

Solr path: “/” (The path, which depends on the Solr server version, to find the server. If the Solr server version is 6.6.4, the Solr path (such as “/solr”) is changed.

Solr core: Type in the name you previously created for Solr core.

Step 3: Create the Search Index

The data sources that you picked for the index will be indexed by the Search API index that we are going to establish here. To make an index,

Navigate to Index addition under Configuration -> Metadata and Search -> Search API.

Integrate Drupal With Apache Solr

Source: Specbee

The next step after successfully building an index is to add fields to the index. Return to the search API and select Edit the index you generated to add the necessary field. The Fields tab will then appear. When you select the fields tab, a window similar to the one in the below image will appear.

Source: Specbee

Click on the Add fields after that. You must add the fields you require in the popup that displays. Once the fields have been added, select Done and then Save.

Source: Specbee

The website now has an index and server established. Transferring the configuration files to the Solr core is the next crucial step after that. You must download the configuration files from the website’s server in order to do this.

Go to Configuration -> Metadata and Search -> Search API.

You’ll see a window similar to the one in the picture below.

Source: Specbee

After that, select the “Get config.zip” option. The config folder will download as a result. After that is finished, extract the zip folder and move all the files into the core’s conf folder.

The Solr core folder that you previously established can be found in the data folder. You will notice a folder named conf if you go to that Solr core folder. You will find a few files in this folder. After downloading all the files from the configuration folder from the website server, remove those files. After finishing, you must use the console to restart your Solr server.

Indexing the contents is the next stage.

Select the constructed index by going to Configuration -> Search and Metadata -> Search API. There will be a window, just like in the picture below.

Source: Specbee

To index the contents, click the index next. At this point, the Solr core has an index for every item. To obtain the results from the Drupal Solr, you can now construct a view of the Solr index and add the indexed fields to the view.

Conclusion

Now, in the end, we hope that through this post you gained knowledge on how to integrate Drupal With Apache Solr. Moreover, if you are looking for a company through which you can hire dedicated Drupal developers then you should check out Appic Softwares.

We have an experienced team of Drupal developers that you can hire from and let them manage your integration. So, what are you waiting for?

Contact us now!

This blog has been inspired by <https://www.specbee.com/blogs/how-configure-apache-solr-drupal-8-powerful-search-experience>