How To Configure Apache Solr with Drupal ?
Step 1: Install Java
Java is a necessary prerequisite for Apache Solr, which is required for search, indexing, and many other features of the Drupal Toolkit.
Step 2: Installing Apache Solr
Apache Solr is a powerful full-text and faceted search server with a list of features, such as highlighting, caching, replication, and a web administration interface. Solr is a Java application that runs within a servlet container, such as Apache Tomcat or Jetty. The easiest and fastest way to get Solr up and running is to simply download the application and run it with the embedded version of Jetty: Download Apache Solr
- Setup Search API : To get Search API working with solr there are a few thing you have to configure with solr. First go and download the following modules from drupal.org and place them into sites/all/modules.
2. Search API
You can download it manually and un-zip into sites/all/modules or you can do this by using
Drush c:\> drush dl entity search_api search_api_solr
After that you need to enable all of these module.
- Configure solr: You have already downloaded Apache Solr. So unzip to root or path you want.
Now copy the schema.xml and solrconfig.xml that ships in “search_api_solr” and paste it into config file of solr (i.e solr\example\solr\collection1\conf). It’s fine to override the existing xml files just make sure you create a bckup.
Now go ahead and test solr with the new xml files.
Open Command Prompt and do this
C:\> cd solr\example
C:\solr\example>java –jar start.jar
Go to see if solr is working with the new xml files.
Step 3: Download SolarPHPClient
Download SolarPhpClient it only works with r22 Solr PHP Client (Built 11/09/09 from r22). This is php solr library. So place it in your module “seach_api_solr” directory.
Step 4: Module to Enable
Go to the modules page and enable the Search API, Search pages and Solr search.
Step 5: Configure search api
Go to Configuration >> Search and metadata >>Search API.
There are three steps involved with setting up a solr search page. First you setup the server, then index and finally the search page.
- Setup server :From the Search API configuration page click on the Add server link.
- Setup Index : After server configured, the next thing you have to configure the index. Click on Add Index from search Api Configuration page.
Then after you can select the field to index .
- Search page : Now that you have the server and the index all sorted we have to create a Search Page. Search API module gives you the ability to create custom search pages on any URL. You are no longer stuck with a single search page on search/node or search/apachesolr_node. Go to the Search API page and click on the Search pages tab, then click on the Add search page link.
Now you can check your search page.