How To Integrate Drupal With Apache Solr

How To Integrate Drupal With Apache Solr

How To Integrate Drupal With Apache Solr

What is 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.

Why 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 are provided by using Drupal Apache Solr.

Implementing Apache Solr in Drupal

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

1. Install Apache Solr

  Step 1: Install JAVA : 

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

 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, stopped, and its status can be checked with following commands:

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

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

After drupal/search_api_solr:~4.1 has been required by 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

Step 2:  Create a Solr Server

You must set up a Solr server and index on 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

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

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. In the event that 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 Datasources that you picked for the index will be indexed by the Search API index that we are going to establish here. In order to make an index,

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

Integrate Drupal With Apache Solr

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.

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.

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.

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.

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!

Get Free Consultation Now!


    Contact Us

    Consult us today to develop your application.

      Get in touch with us


      Skype Whatsapp Gmail Phone