
Before getting on with the actual topic of integrating Solr with Drupal 8, let us get the basics out of the way. What is Solr?
Solr is an open source search platform built on a Java library called Lucene. One of the few reasons it is favored is because Solr is enterprise-ready, fast and highly-scalable. The applications built using Solr are sophisticated and deliver high performance.
The following are some reasons why Solr is a popular search platform:
-
Solr works like magic for full text indexing, which is otherwise difficult to achieve with database/core search.
-
Solr provides mind blowing text-analysis/stemming/full text search scoring/fuzziness functions. This is very trivial and limited with database search.
-
Core search is not adequate when you have a great deal of content or high traffic on site.
-
Complex search queries run sluggishly with database search, whereas Solr can process complex queries with its powerful index and text analysis ability.
-
It does not put any stress on your database.
-
It enables performance of lightning fast search results.
Installing Solr on Ubutu 16.04 or higher
For this installation, the following commands need to be executed:
-
sudo apt-get install python-software-properties
-
sudo add-apt-repository ppa:webupd8team/java
-
sudo apt-get update
-
sudo apt-get install oracle-java8-installer
-
wget http://www.us.apache.org/dist/lucene/Solr/6.6.1/Solr-6.6.1-src.tgz
-
tar xzf Solr-6.6.1.tgz
-
cd Solr-6.6.1/bin
-
sudo ./install_Solr_service.sh
Integration with Drupal
-
Required Drupal Modules
-
Search api (search_api)
-
Search api Solr (search_api_Solr) (Requires search_api)
-
Facets (facets) (Optional)
Drupal Solr configurations are provided in search_api_Solr module itself.
search_api_Solr/Solr-conf/6.x (Path to drupal Solr configuration for Solr version 6.x)
Configuring Solr core for Drupal
Follow these easy steps to configure Solr core for Drupal:
-
Create a new core in your Solr.
- Create directory Solr-root/server/Solr/drupal8
-
Create data directory in your core - Solr-root/server/Solr/drupal8/data
-
Create conf directory in your core - Solr-root/server/Solr/drupal8/conf
-
Copy configuration from search_api_Solr module to new Solr config dir.
Solr and Drupal, both being open-source, are powerful, flexible and highly scalable. Both can handle high-traffic websites and applications. Hence, they are a perfect match for each other. If you have any questions about Solr, get in touch with us and we will help you sort them out!