Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

41
Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site Peter M. Wolanin, Ph.D. Momentum Specialist (principal engineer), Acquia, Inc. Drupal contributor drupal.org/user/49851 co-maintainer of the Drupal Apache Solr Search Integration module July 21, 2012

description

The Apache Solr Search Integration module provides integration with the (free, open-source) Apache Solr server. This great combination of Drupal with a powerful and flexible search server will make your site irresistible to visitors by providing advanced search features like faceting filtering and by delivering the most relevant search results from your site. The module has been re-written for Drupal 7 to integrate with Facet API and those changes have been backported to a new Drupal 6 branch. Thus, you can use this module for all your projects, as well as setting up a shared search index that allows you to search across different Drupal 6 and Drupal 7 sites. This talk will focus on explaining configurations options in the admin UI to help you quickly and confidently configure the facets, pages, related content blocks, and other features for your site. Highlights may include: - What are the key Solr concepts you need to understand to get the most out of Solr integration? - How is the module admin UI organized? - How do I configure facets, sorts, and content recommendation blocks? - How can I use additional modules to index file attachments?

Transcript of Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Page 1: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Peter M. Wolanin, Ph.D.Momentum Specialist (principal engineer), Acquia, Inc.

Drupal contributor drupal.org/user/49851co-maintainer of the Drupal Apache Solr Search Integration module

July 21, 2012

Page 2: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Pizza Without Beer?

Page 3: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Ok, Drupal alone is great, but a we can make it even more appealing and satisfying.Are you wondering how hard it is to actually integrate Apache Solr with Drupal?Do you like things that are easy yet powerful?

Pizza Without Beer?

Page 4: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Drupal + Solr Provides Immediate Access to Rich Search FeaturesDynamic content requires dynamic navigation - which is provided by an effective search.Search facets mean no dead ends.Solr provides better keyword relevancy in results.Much faster searches for sites with lots of content.By avoiding database queries, Drupal with Solr scales better.

Page 5: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Many Solr Integration Challenges Are Already Solved for You

The most important - content indexing.Facets, sorting, and highlighting of results.Immediate integration with the More Like This and spell-check handlers.Included sub-module integrates content access permissions by indexing to and filtering Solr results based on the current user.

Page 6: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

What are the key Solr concepts you need to understand to get the most out of the Apache Solr Search Integration module?How is the module admin UI organized?How do I configure facets, search pages, and content recommendation blocks?How can I index file attachments?

Key Questions to Be Answered

Page 7: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Drupal sends data to Solr as XML documentsPOST XML to /update to add or delete.Search via GET requests.If something is not working as expected, you can try searching directly in Solr via URLSolr also includes admin and analysis interfaces (you need to lock this down for production).

Solr Interface/API is HTTP

Page 8: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 9: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Enable the Modules

Page 10: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 11: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 12: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 13: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 14: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 15: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 16: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 17: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 18: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 19: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

?q=search/node/ratis WTH? no facets!

Page 20: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 21: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

?q=search/site/ratis

Page 22: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Easy Content Recommendation!Uses the MLT handlerPicks fields from the currently viewed node

Page 23: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Search Environments Reference Different Servers and/or Config

Most people need only one to start.The most important use is to bundle different sets of enabled facets and their configuration - e.g. for different search pages.Can also be used to search multiple servers.Each has its own ID and config variables.

A short diversion...

Page 24: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 25: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 26: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 27: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 28: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 29: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

The Module Has a Pipeline for Indexing Drupal Content to Solr

Drupal entities are processed into one (or more) document objects. Each document object is converted to XML and sent to Solr.

titlenidtype

Node object Document object

Drupalcallbacks & hooks

entity_typelabel

entity_idbundle

XML string

<doc> <field name="entity_type">node</field> <field name="label">Hello Drupal</field> <field name="entity_id">101</field> <field name="bundle">session</field></doc>

Page 30: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 31: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Entity Meta-data Gives Automatic Facets!

Content typesTaxonomy terms per vocabularyContent authorsPosted and modified datesText and numbers selected via select list/radios/check boxes

Page 32: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Updates to an Entity or Related Meta-data Cause Reindexing

Drupal entities are indexed during Drupal cron.By using a specialized tracking table, content can automatically be queued for reindex when changed, and subsets of content can potentially be sent to different Solr indexes.Entities include many ID-based reference fields (e.g. the User ID of the node author). Changes to the referenced data is also watched.

Page 33: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Finding the “Right” ResultsA big frustration is when the result you expect for a keyword or set of keywords is not first, or even on the first page.Apache Solr has very flexible result scoring - you just need to know how to tune it.Different sites have different needs - the default settings may be poor for yours.acquia.com/blog/delivering-right-search-results

Page 34: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 35: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 36: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 37: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

More Modules Available to Add More Features

ApacheSolr AttachmentsApache Solr Multisite SearchApache Solr Organic Groups IntegrationApachesolr User indexingApachesolr Commerce

A few examples:

Page 38: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Attachments Too !

Page 39: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site
Page 40: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

To Wrap Up !

Drupal has extensive Apache Solr integration already, and it is highly customizable in the UI.Apache Solr Search Integration offers more robust integration as compared to Search API Solr and both Drupal 6 and 7 support.Acquia includes a secure, hosted Solr index with every support subscription. Get started fast with a 30 day free trial.

Page 41: Drupal and Apache Solr Search Go Together Like Pizza and Beer for Your Site

Do you love Drupal, Solr, the LAMP stack, DevOps or anything related, and working at a fast-growing and successful startup?Boston, Portland, D.C. area U.S. offices.Some remote opportunities as well.Come talk to [email protected] in IRC #drupal-apachesolr

Acquia is Hiring!