Next Tutorial

Drupal 7 Tutorial Part 16: Drupal 7 Reports & Logs Explained

How to integrate Apache Solr with Drupal 6 in windows or linux

Submitted by anilsagar on Thu, 05/20/2010 - 23:25

Hi Everyone,

 

I want to share my experience of integrating Apache Solr (Full text search and powerful than drupal core search) with Drupal 6.

Step 1: Download Apache Solr module from here http://drupal.org/project/apachesolr, and place it in your drupal contributed modules folder.

 

Step 2: Before enabling the module, we need to do some additional configurations. Download the apachesolr php client library from here http://code.google.com/p/solr-php-client/downloads/list . After extracting the files, place solrphpclient folder into apachesolr module folder.

 

Step 3: Now enable Apache Solr Framework and Apache Solr Search modules from admin/build/moules section.

 

Step4:  Now download Apache Solr from here. http://apache.osuosl.org//lucene/solr/1.4.1/apache-solr-1.4.1.zip and extract the contents.

 

Step 5: Unpack the tar ball or zip file downloaded in step 3 outsite your drupal installation and outside web root.

 

Step 6:  Goto /apachesolr1.4.0/example/solr/conf and copy schema and solrconfig files to the same directory and rename them as schema.bak and solrconfig.bak

 

Step 7: Copy schema and solrconfig files from your drupal installation apachesolr module to above location and replace wih existing files.

 

Step 8: Now open your command prompt and browse to apachesolr1.4.0/example directory.

 

Step 9: Type belo command to start apachesolr service

               >> java -jar start.jar

Step 10: Test your solr server admin innterface by visiting http://localhost:8983/solr/admin/ . If you can able to see admin page then your solr is running and ready to use with drupal.

 

Step 11:  Its time to configure drupal search with apache solr. Please goto admin/settings/apachesolr/index and run cron to index the content using apache solr search engine.

 

Step 12: Now goto admin/settings/apachesolr click on advanced configuration and make apache solr as default search. Now go to admin/settings/apachesolr/enabled-filters and enable the sorting filtrers.

 

Step 13: Now goto blocks and enable the necessary apache solr related blocks.

 

Step 14: To enable facets please go to admin/settings/apachesolr/enabled-filters and enable filters. Now go to blocks and enable the facets filtering blocks where ever you want !!

 

Thats it...... Improved search performance is infront of your eyes. You can sort the content using the sort block. Amazing user experince and amazing search speed. I love it!!

 

Cheers,

Anil Sagar

12 comments

How can I keep it running on windows?

Submitted by Anonymous on Thu, 03/08/2012 - 01:20.

Hello, thanks for the article! I see the comment below about keeping it running, but that's for Linux. Any idea how to keep it running on Windows?

Good article

Submitted by Anonymous on Tue, 12/13/2011 - 11:50.

This is a great article !!! Helped me to integrate the Apache solr ... Thanks !!!

Solr Facets Question

Submitted by Anonymous (not verified) on Thu, 06/09/2011 - 23:29.

I did everything as you have mentioned. My drupal is able to index data to solr and retrive search results. I have below issues
1. My facets are not showing up. I have panels, i added facets to panels. No luck with this.
2. I somehow tweaks my code to filter data by content type by adjusting the request url. But when i pass "solrsort=changed desc" in request url, data is not getting sorted.
Any suggestions ?

Thanks

Follow below steps to keep solr running

Submitted by anilsagar on Mon, 06/06/2011 - 20:51.

Step 1: First, find out where java is located on your machine. The command below will tell you where it is:
             $ which java
Step 2: Then, stick the following code into a shell script, replacing the java path below (/usr/bin) with the path you got from the above command.<code>
#!/bin/bash
cd /usr/java/apache-solr-1.4.0/example
/usr/bin/java -jar start.jar
</code>
You can save this script in some location (e.g., $HOME) as start.sh.

Step 3:  Give it world execute permission (to simplify) by running the following command:
$ chmod og+x start.sh

Step 4: Now, test the script and ensure that it works correctly from the command line.
$ ./start.sh

Step 5: Type below command
$ crontab -e

This will bring up an editor. Add the following line to it:

@reboot /home/somedir/start.sh

If your Linux system supports it (which it usually does), this will ensure that your script is run upon startup.

This should solve your problem.
 

Keep solr running

Submitted by Anonymous (not verified) on Mon, 06/06/2011 - 17:43.

Thank you for your post it was very helpful. If you could please tell me how I keep solr running that would be great help. I get solr running and it works well. But after a few hours I notice that it stops and I need to start solr again using the java -jar start.jar command. I have cron running every 20 minutes.

Thank u very much.its so

Submitted by jaisri (not verified) on Thu, 05/05/2011 - 15:29.

Thank u very much.its so helpful article .its helped me a lot

I need help

Submitted by Anonymous (not verified) on Sun, 04/10/2011 - 12:14.

I need help in installation of appache solr
when i clicked on this link

http://apache.mirrors.hoobly.com/lucene/solr/1.4.0/apache-solr-1.4.0.zip

I got following error

Not Found

Hi

Submitted by anilsagar on Fri, 04/15/2011 - 22:51.

I updated the link. Now you can able to download.

Cheers,
Anil Sagar

Excellent

Submitted by Anonymous on Wed, 03/09/2011 - 11:18.

Excellent information

Thank you !

Submitted by Anonymous on Fri, 01/14/2011 - 18:39.

Great , thank you !

Need more info.

Submitted by Anonymous on Tue, 01/11/2011 - 14:56.

Hi Sagar, thanks for your kind info. but i have some queries. i have installed the apache solr in localhost. it works fine. but how to install it in the server side ? How to Keep the Apache Solr Running? (Ie...>> java -jar start.jar) Where to place the "apache-solr-1.4.0" folder ..??
It will be very helpful to me if you give the info.

little query..

Submitted by Anonymous on Fri, 06/04/2010 - 13:18.

U are running start.jar..
Does it need to keep running for solr to work day n night...
Or is dere any other way out..

©2010 AnilSagar. All rights reserved. Drupal theme by Kiwi Themes.