Ivan Zugec

Drupal Consultant

Add alternative search with the Lucene API module

The Search Lucene API module is an alternative search module which can be used on your Drupal site. It's powered by a stripped down version of the Zend Lucene Search which is a PHP port of Apache Lucene. Because it's all PHP do don't have to worry about running the search on a separate server or setup other applications to run the search.

To install Search Lucene API go to http://drupal.org/project/luceneapi and download the module. Unzip the module into "sites/all/modules".

The module also requires a stripped down version of the Zend Lucene Search which you'll have to download separately.

On the module project page you'll see a direct link under the installation heading.

fig_1.jpg

Unzip the lib directory that’s in the file and place it in "sites/all/module/luceneapi/lib".

fig_2.jpg

Once the module and files are in place to go Administer >> Site building >> Modules and enable all 3 modules.

fig_3-2.jpg

Building the index

For the actual search to work you’ll have to build the index. This index is separate to the core Drupal search, it’s stored in the files directory so if you are having problems with indexing make sure your files directory is setup.

Luckily you can run the indexing as a batch job which mean you don’t have to run cron 20 times to index the site. Go to Administer >> Site configuration >> Search Lucene Content. Click on the Index statistics tab.

To index click on the Index remaining nodes button.

fig_4.jpg

The time it’ll take to index solely depends on the amount of nodes you have on your site.

fig_5-1.jpg

Setup Faceted search

One of the features that Search lucene API gives you is the faceted search block.

fig_6.jpg

To get faceted search working requires a few steps.

First, go to Administer >> Site configuration >> Search Lucene Content and click on the Facets tab (If you can't find the tab make sure you have enabled the Search Lucene Facets module).

Then select which facets you want to be visible within the block.

fig_7-1.jpg

Second, we must set the right permissions for the block to be visible to users. Go to the permissions page and tick use advanced search for anonymous and authenticated users.
Also make sure you have the search content permission assigned to a role.

fig_8-1.jpg

Last but not least, you must enable the Search Lucene Facets: Search Lucene block. To do this go to Administer >> Site building >> Blocks and add the block to the left side or which ever region you want.

fig_9-1.jpg

As you can see within about 30 minutes you can have an alternative search setup for your Drupal site. If you have any questions just leave a comment.

Also check out the project page for other Related Projects, which will take your search to the next level.

Comments

Anonymous's picture

Submitted by Anonymous on

Many thanks for the article, I think I'll probably use it in future projects!

Also, I thought the article was straight to the point and clear to read, nice job!

Murray's picture

Submitted by Murray on

I bumped into this page of yours after attending your presentation at Sydney Drupal meetup. I'll definitely check it out.

Anonymous's picture

Submitted by Anonymous on

Thanks for the article. I used it for my first installation of lucene..i will use it on a small project.

Chris Pliakas's picture

Awesome article. I put a link to it on the Search Lucene API project page because it is the best resource I have found for installing the module.

Thanks for the great contribution,
Chris

Add new comment