-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
1/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
http://www.lucidimagination.com/events/revolution2010 -
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
2/26
2010 Acquia, Inc.
What You Will Learn
A little about Drupal
Drupal terminolgy
Examples of Drupal sites using Apache Solr
How Drupal works with Apache Solr
Conguration options for searches
Customization possibilities
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
3/26
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 2009
blogs /
wikis
forums /
comments
social
ranking
social
tagging
users
social
networks
workow
taxonomy
semanticweb
RSS
content
analytics
ContentMgmtSystems
SocialSoftware
Tools
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
4/26
2010 Acquia, Inc.
Drupal Has User Accounts, Roles &
Permissions
Dene custom roles
Set granular access
controls by role
Task / object-basedCongure user
behavior:
Registration
Email
Proles
Pictures
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
5/26
2010 Acquia, Inc.
Drupal Modules Add Functionality
Theres a module for that
More than 4,700
community modules
available for Drupal 6.x
Often controlled by role-
based permissions
Drupal core and modulesare GPL v2+, and have a
huge, active community
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
6/26
2010 Acquia, Inc.
Drupal Theme Controls Appearance
Content presentation
Separate from data
Denes how content is
displayed
Alter module output
Components include
CSS les & PHP
template lesSupport sub-themes
for rapid customization
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
7/26
2010 Acquia, Inc.
Drupal Nodes are Content + Data
Nodes are the basic unit
of content
The 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
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
8/26
2010 Acquia, Inc.
Node Types are Enriched With CCK Fields
Dene new data elds
within a node using the
CCK module.
Text, images, integers,date, reference, etc
Flexible and
congurable in the UI
No programmingrequired (many existing
modules dene elds)
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
9/26
2010 Acquia, Inc.
Apply Taxonomy Vocabulary & Terms
Provide a strongframework for content
classication
Modules provide
taxonomy-based
appearance, access
control
Standard input optionsinclude free tagging,
at-controlled, and
hierarchical-controlled
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
10/26
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/
http://www.lucidimagination.com/blog/2009/02/19/drupalorg-fires-up-on-solr/ -
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
11/26
2010 Acquia, Inc.
Drupal + Solr Has Immediate Benets
Dynamiccontent requires dynamicnavigation -
which is provided by an eective 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 Solrscales better
http://www.lucidimagination.com/blog/2009/02/19/drupalorg-fires-up-on-solr/ -
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
12/26
2010 Acquia, Inc.
Node Data Gives Automatic Facets
Content types
Taxonomy terms per
vocabularyContent authors
Posted and modied dates
Text and numbers
selected via select list/
radios/check boxes
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
13/26
2010 Acquia, Inc.
Easily Add Content Recommendation
Uses the MLT handlerPicks elds from the currently viewed node
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
14/26
2010 Acquia, Inc.
Congure Each MLT Block in the UI
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
15/26
2010 Acquia, Inc.
Advanced Solr Features Plus
Conguration in the UI
Dynamic elds in schema.xml index CCK and
custom node data elds
Query-time boosting options available in the UIDismax handler used for easy keyword searching
and per-eld boosts
Add a Drupal modules for attachment indexing
Another module for multi-site search
Heres a quick look at the admin interface:
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
16/26
2010 Acquia, Inc.
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
17/26
2010 Acquia, Inc.
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
18/26
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
19/26
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
20/26
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
21/26
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 canimplement module and theme hooks to extend or
alter Drupal behavior.
Change or replace the data normally indexed
Modify the search results and their appearance
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
22/26
2010 Acquia, Inc.
Image Data Using Dynamic Fields/*** Implementation of hook_apachesolr_update_index().
*/functionapachesolr_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 ($sizesas$name=>$info) { $areas[$name]=$info['width']*$info['height']; } asort($areas); $image_path=FALSE;
foreach ($areasas$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().*/functionapachesolr_image_apachesolr_modify_query(&$query,&$params,$caller) { // Also retrieve image thumbnail links. $params['fl'].=',ss_image_relative';}
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
23/26
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
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
24/26
2010 Acquia, Inc.
To Wrap Up
Drupal has extensive Apache Solr integration
already, and is highly customizable.
The Drupal platform is widely adopted, and theDrupal 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.
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
25/26
2010 Acquia, Inc.
Resources ... Questions?
http://drupal.org/project/apachesolr
http://drupal.org/project/apachesolr_attachments
http://drupal.org/project/luceneapi (pure PHP)
SF video: http://www.archive.org/details/
ApacheSolrSearchMastery
http://acquia.com/category/tags/apachesolrhttp://groups.drupal.org/lucene-nutch-and-solr
-
8/8/2019 Drupal Integartion With Solr for Fabulous CMS Search
26/26
2010 Acquia, Inc.
Drupal Adapts toYou!
http://www.lucidimagination.com/events/revolution2010/presentation-abstracts