drupal integration with solr for fabulous cms search

26
© 2010 Acquia, Inc. Drupal Integration with Solr for Fabulous CMS Search Peter M. Wolanin, Ph.D. Principal Engineer, Acquia, Inc. Drupal contributor drupal.org/user/49851 co-maintainer of the Drupal Apache Solr Search Integration module October 7, 2010

Upload: acquia

Post on 08-May-2015

3.132 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Drupal Integration with Solr for Fabulous CMS Search

Peter M. Wolanin, Ph.D.Principal Engineer, Acquia, Inc.Drupal contributor drupal.org/user/49851co-maintainer of the Drupal Apache Solr Search Integration module

October 7, 2010

Page 2: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

What You Will Learn

A little about DrupalDrupal terminolgyExamples of Drupal sites using Apache SolrHow Drupal works with Apache SolrConfiguration options for searchesCustomization possibilities

Page 3: Drupal Integration with Solr for  Fabulous CMS Search

Drupal: Web Application Framework + CMS == Social Publishing Platform

© 2010 Acquia, Inc.

Drupal “… is as much a Social Software platform as it is a web content management system.”

CMS Watch, The Web CMS Report 2009blogs /wikis

forums / comments

socialranking

social tagging

users

social networks

workflow

taxonomy

semantic web

RSS

content

analytics

ContentMgmtSystems

SocialSoftware

Tools

Page 4: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Drupal Has User Accounts, Roles & Permissions

Define custom roles Set granular access controls by role– Task / object-based

Configure user behavior:– Registration– Email– Profiles– Pictures

Page 5: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Drupal Modules Add Functionality

“There’s a module for that”More than 4,700 community modules available for Drupal 6.xOften controlled by role-based permissionsDrupal core and modules are GPL v2+, and have a huge, active community

Page 6: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Drupal Theme Controls Appearance

Content presentation– Separate from data– Defines how content is

displayed

Alter module outputComponents include CSS files & PHP template filesSupport sub-themes for rapid customization

Page 7: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Drupal Nodes are Content + DataNodes are the basic unit of contentThe node system is extensible - can represent any dataExamples of content stored within Drupal– Text– Images– MP3s– Node reference

Node 7 Node 9Node 8

Node 4 Node 6Node 5

Node 1 Node 3Node 2

Page 8: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Node Types are Enriched With CCK Fields

Define new data fields within a node using the CCK module. – Text, images, integers,

date, reference, etc

Flexible and configurable in the UINo programming required (many existing modules define fields)

Page 9: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Apply Taxonomy Vocabulary & Terms

Provide a strong framework for content classification Modules provide taxonomy-based appearance, access controlStandard input options include free tagging, flat-controlled, and hierarchical-controlled

Page 10: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Drupal + Solr Powers Search for Businesses, Governements and NGOs

http://www.whitehouse.gov/search/site/http://www.mattel.com/search/apachesolr_search/

http://www.hrw.org/en/search/apachesolr_search/http://www.restorethegulf.gov/search/apachesolr_search/

http://www.nypl.org/search/apachesolr_search/

http://www.mylifetime.com/community/search/apachesolr_search/

http://opensource.com/search/apachesolr_search/

https://www.ethicshare.org/publications/

http://www.poly.edu/search/apachesolr_search/

Page 11: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Drupal + Solr Has Immediate Benefits

Dynamic content requires dynamic navigation - which is provided by an effective searchSearch facets mean no dead endsSolr provides better keyword relevancy in resultsMuch faster searches for sites with lots of contentBy avoiding database queries, Drupal with Solr scales better

Page 12: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Node Data Gives Automatic Facets

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

Page 13: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Easily Add Content Recommendation

Uses the MLT handlerPicks fields from the currently viewed node

Page 14: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Configure Each MLT Block in the UI

Page 15: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Advanced Solr Features Plus Configuration in the UI

Dynamic fields in schema.xml index CCK and custom node data fieldsQuery-time boosting options available in the UIDismax handler used for easy keyword searching and per-field boostsAdd a Drupal modules for attachment indexingAnother module for multi-site search

Here’s a quick look at the admin interface:

Page 16: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Page 17: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Page 18: Drupal Integration with Solr for  Fabulous CMS Search
Page 19: Drupal Integration with Solr for  Fabulous CMS Search
Page 20: Drupal Integration with Solr for  Fabulous CMS Search
Page 21: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Drupal Modules Implement hooks to Control Indexing and Retrieval of Data

hook_apachesolr_update_index(&$document, $node, $namespace)

By creating a Drupal module (in PHP), you can implement module and theme hooks to extend or alter Drupal behavior. Change or replace the data normally indexedModify the search results and their appearance

Page 22: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Image Data Using Dynamic Fields/** * Implementation of hook_apachesolr_update_index(). */function apachesolr_image_apachesolr_update_index(&$document, $node, $namespace) { if ($node->type == 'image' && $document->entity == 'node') { $areas = array(); $sizes = image_get_derivative_sizes($node->images['_original']); foreach ($sizes as $name => $info) { $areas[$name] = $info['width'] * $info['height']; } asort($areas); $image_path = FALSE; foreach ($areas as $preset => $size) { $image_path = $node->images[$preset]; break; } if ($image_path) { $document->ss_image_relative = $image_path; // Support multi-site too. $document->ss_image_absolute = file_create_url($image_path); } }}

/** * Implementation of hook_apachesolr_modify_query(). */function apachesolr_image_apachesolr_modify_query(&$query, &$params, $caller) { // Also retrieve image thumbnail links. $params['fl'] .= ',ss_image_relative';}

Page 23: Drupal Integration with Solr for  Fabulous CMS Search

if ($image_path) { $document->ss_image_relative = $image_path; }

/** * Implement hook_apachesolr_modify_query(). */function apachesolr_image_apachesolr_modify_query(&$query, &$params, $caller) { // Also retrieve image thumbnail links. $params['fl'] .= ',ss_image_relative';}

© 2010 Acquia, Inc.

Image Data Using Dynamic Fields

Page 24: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

To Wrap Up

Drupal has extensive Apache Solr integration already, and is highly customizable.The Drupal platform is widely adopted, and the Drupal community drives rapid innovation.Acquia provides Enterprise Drupal support and a network of partners.Acquia includes a secure, hosted Solr index with every support subscription.

Page 25: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Resources ... Questions?

http://drupal.org/project/apachesolrhttp://drupal.org/project/apachesolr_attachmentshttp://drupal.org/project/luceneapi (pure PHP)SF video: http://www.archive.org/details/ApacheSolrSearchMasteryhttp://acquia.com/category/tags/apachesolrhttp://groups.drupal.org/lucene-nutch-and-solr

Page 26: Drupal Integration with Solr for  Fabulous CMS Search

© 2010 Acquia, Inc.

Drupal Adapts toYou!