Drupal’s standard search works for minor to average size websites. The standard search does not need any server specifications and it is easy to setup. For larger sites with more sophisticated and advanced searches, The Core search will not do. A great idea is to combine Drupal’s core search with Solr to incorporate faceted searches and specific search options. Apache Solr offers extension and strengthened execution over the original Drupal search.

Apache Solr

Apache Solr is an advanced search option that is focused on producing an integrated and detailed search interface. The API was initially created as a project for CNET and presented to Apache in 2006. Drupal provides an Apache Solr module to make the integration process easier.

Apache Solr operates from an online server and needs some additional assistance to get up and running. A basic server setup will not do as it requires advanced server options to run. Because it is independent of the website’s server, it can operate and process on its own.

Apache Solr

Integrating Apache Solr with Ubercart and Drupal

Let’s talk about Drupal’s Ubercart module and how Solr can work well with it to sell website content. Ubercart gives you the option to sell files with the option to download them to your personal device. This can range from a PDF to a software file.

With Ubercart, you are able to change the role of a user temporarily and reverted back to a role after a certain period. If you combine Apache Solr’s advanced search capability with Ubercart’s extensive features, you have a powerful platform to use.

Faceted Navigation

Faceted Navigation is the action of searching for specific criteria with a search engine. An example is an online car dealership where the user narrows the search down to their budget and the year of the motor vehicle. You might also have the option of narrowing down the Manufacturer make and the model.

The Apache Solr module works with Drupal to give data to Apache Solr. Users are able to put in words that have been attached to certain content to narrow down the search.

Added efficiency with Solr

Sites with a lot of activity can lower the sites performance due to the data being requested too frequently. Even sites with a lot of content and a small amount of traffic could be affected. Intricate requests can be sluggish to load.

People are requesting faceted searches more frequently now. It can be provided integrated with Drupal search but the implications are made by the module’s programmers and engineers.

What else can Apache Solr do?

Solr can index and crawl a large number of sites, running through attached documents in word or PDF format and giving suggestions for blocks. You can check the Module’s notes and features to find out more of what it can do when it integrates with Drupal.

Acquia search and Solr

Acquia search provides a computing platform and a solution stack as a cloud service. Acquia is basically Apache Solr with a Service Level Agreement. Is relatively easy to setup, easy to manage and it extends well.

Acquia search is such a great option because it eases the hosting requirements. If you don’t want to depend too much on another service, Apache Solr might be the better option. Apache Solr also provides a more detailed search with regards to faceting.

Is Apache Lucene and Apache Solr the same?

Apache Solr and Apache Lucene were not the same initially, but eventually became the same when they were fused. Apache Solr is like the shell of a machine which would be called Apache Lucene. Apache Solr is commonly referred to as Apache Lucene.

drupal

How to get Apache Solr working with Drupal

Here is how to setup Apache Solr for an Apple Macintosh computer.

  1. You will need to install Java on your device. Apache Solr will need the latest version, so ensure that it is up to date. Then, go to the apache.org website and download Apache Solr.
  2. We can use a web server Jetty which is included with the installation for testing purposes. It is located within the example folder. Run the start.jar file to get it up and running.
  3. Ensure it is running by going to this URL => http://127.0.0.1:8983/solr/admin. You should see ‘Solr admin (example)’ as the heading.
  4. Now it is time to setup the Search API. First you will need to download a few modules. These are ‘Entity’, ‘Search API’ and ‘Search API Solr Search’. They can be found on drupal.org.
  5. Copy the schema.xml and solrconfig.xml files and paste it in the Solr config folder. Make backups of the original files that are begin replaced. When this is done, you can use http://127.0.0.1:8983/solr/admin to test if the config files are working. You should see ‘search api 1-10’ instead of ‘example’ at the top.
  6. Next we need to download the Solrphpclient from http://code.google.com/p/solr-php-client/downloads/list and place it in the search_api_solr directory.
  7. Then enable the ‘Search api’, ‘Search pages’ and ‘Solr search’ on the modules page.
  8. In configuration, click ‘Search API’ and click ‘+ add server’.
  9. Enter your server name and choose the ‘solr service’ class from the ‘service class’ drop down menu and continue.
  10. Tweak the service details to your convenience and save the settings.
  11. Next, click on ‘+ index’ beside the ‘+ server’ link.
  12. Name the index and select the Node type from the drop down menu. Select ‘solr’ as the server.
  13. Select the fields that you want to be indexed and continue.
  14. Next is the workflow page. Leave it alone for this installation and click on the ‘index now’ button.
  15. Go to the Search API page and click ‘+ add search page’.
  16. On the add search page enter the Search name, index and path.
  17. You have the option leave the settings how they are on the next page and continue.
  18. Test out your page and see how it runs.

Here is how to set up a faceted search:

  1. Enable the ‘Search facets’ module on the modules page.
  2. Click on ‘edit’ for the index that you just created then select ‘facets’.
  3. Enable the selections you want faceted and save the settings.
  4. Assign the selections to a region.
  5. Now it’s time to test it out on the search page.

Written by James Dean: James Dean is a avid hiker, that lives & breathes the outdoor life, capturing with his childhood passion of photography. Following his interest in business, he writes columns for Orange County Drupal Developers. Follow him on Google.