SlideShare a Scribd company logo
INTRO TO SEARCH
IN DRUPAL 7
Create an optimal search experience
Welcome!
SECTION 1:
WHAT ARE WE
SEARCHING FOR?
Introduction
We need search!
The problem
Why do you need search?
• Commerce - increase sales?

• Large amounts of data?

• Connecting people to information?

!
• Share some examples!
Our sample travel site
• Administration > Structure > Content types

• Administration > Reports > Field list
Core search - what’s
in the box?
We need a search page!
Drupal 7 core search
• Interval defines how often updated content is
being processed and sent to the index.
Cron.php
Indexing 

process
Core search indexing
• HTML Tag Scores!
• <H1> scored at 25 !
• <H2> scored at 18!
• Headings have higher
scores than content.!
• Accent Removal!
• Montréal => Montreal!
• Stemming!
• skips, skipping also
means “skip”
Core search limitations
• SQL Not optimized
for full text search!
• Limited Operators!
• Slow/not scalable!
• Stemming happens
on PHP side, not
optimized!
• Dead ends
Demo: Core search
• Load up Drupal core search

• Confusing UI

• Advanced search? Users don’t use it.

• Confusing UI of Search page

• Can’t customize options

• Index?

• Limitations for fine-tuning
Exercise 1: Core search
configuration
• Load up Drupal core search

• Confusing UI

• Advanced search? Users don’t use it.

• Confusing UI of Search page

• Can’t customize options

• Index?

• Limitations for fine-tuning
Dead ends....
• A bad landing page, with no suggestions.

• “Don’t make me think”.
What are
alternatives?
Alternatives to core search
• Full services:!
• Google’s Custom
Search !
• Google Search
Appliance!
!
• Indexing software:!
• Fuzzy Search!
• Elasticsearch!
• Apache Solr
Apache Solr
• Based on Lucene!
• Written in Java; uses
container such as
Tomcat or Jetty!
• Mathematical
Indexing!
• Replication / Solr
Cloud!
• Multiple indexes
(Multicore)
Apache Solr
• Separate Server!
• Indexes your site!
• Widely used and
tested
GET (POST)
Search
*SQL
Web
ServerPOST
index
Solr
Integrating Apache
Solr and Drupal
Integrate Solr w/ Drupal
• Search API

• Apache Solr Search Integration
Customizing Solr
• Improve the Index

• What Solr is storing

• How Solr indexes information

• Improve the Query

• What is being requested from Solr

• Improve the Results

• What is displayed to the user, and how they
navigate the search experience
http://2012.pnwdrupalsummit.org/sessions/customizing-apache-solr-search-experience
SECTION 2:
CONFIGURE SOLR
SEARCH IN DRUPAL
Getting set up
What comes with
Solr?
Comparisons
Core index config Solr index config
Available with Solr
Spell checking Bias settings Suggestions
“More like this”
• Example from NIH.gov: 

Instead of using Entity reference fields.

• You can configure multiple suggestion blocks
for specific content types or site sections.
Sorting options
• A block to allow users to alter sort.
Demo: What comes
with Solr?
• Enable the modules. 

• Index the site. What is indexed?

• Spelling correction offered out of the box,
difference with core search.

• Re-index, when does “cron” run?

• More like this block, place and configure.

• Search page configuration under Pages/
blocks.
Exercise 2: Configure Solr search
• A. Ensure search is installed and enabled

• B. Index site

• C. Review default results

• D. Configure your search page

• E. Place a “more like this” block on your site.
SECTION 3:
HOW TO IMPROVE
SEARCH
Boosting relevant results
Ways to optimize
search
Optmization options
• Phrases

• Search for sentences, phrases

• Optimize search for specific use cases

• More recent content, is it more relevant?

• Content with comments, are they more useful?

• Body content, use of H2 and H3?

• Synonyms

• synonyms.txt -
Demo: Optimize results
• Bias settings

• When changes take effect

• Before and after examples
Exercise 3:
Optimize your search results
A.Test search before changes

B.Improve the result biases

C.Testing the changes; how to check the
Index

D.Improve term proximity results

E.Improve bias based on fields and terms
SECTION 4:
FACETS AND
WIDGETS
Filtering and displaying results
Facets: What users
want
Facets provide useful filters
Shows what
it’s filtered on
Bravo.com, Drupal site
Select content
.net magazine, Drupal site
Offer facets people need
Do clients sort by
name?
Use facets and
sorting which
influence
decisions.
!
Material
Color, etc
made.com, not a drupal site
Tips to define facets
• Listen to users

• Analyze query logs to define facets. 

• Use popular words to label facets.

• Check competitors and across your industry.

• Choose important facets 

• On which facets do people make decisions?

• Which features influence a purchase?

• Plan content types for searching

• Depends on your content model, taxonomy, fields!
http://uxdesign.smashingmagazine.com/2009/12/08/principles-of-effective-e-commerce-search/
How are our users searching?
• What facets would you enable on this site?
Facets API in Drupal
About Facets
• For each facet you configure:

• A display widget

• A corresponding query type. 

• A block to place, some examples:
Example display widgets
With Facet API Additional modules
Links Tag cloud 

drupal.org/project/facetapi_tagcloud
Links with checkboxes Slider 

drupal.org/project/facetapi_slider
Demo: Configuring facets
• Enable the module.

• Review options for configuring facets for
different displays.

• Display widgets, relate to specific queries.
Exercise 4:
Configure a facet slider
• A. Configure the facet options

• B. Place the population facet block

• C. Test the search

• D. Enable the slider for display

• E. Test the search again
SECTION 5:
HOW TO IMPROVE
USER EXPERIENCE
The user experience
Established standards
• Users expect the search form to be... where?

• Queries

• Should be easy to refine

• Incremental construction

• Results 

• Display the query

• Easy to read key information
http://uxdesign.smashingmagazine.com/2009/12/08/principles-of-effective-e-commerce-search/
Beyond the defaults
• Limitations:

• Default results don’t show relevant data specific to
your site: dates, numerical data, location maps.

• Better:

• Landing page revealing the content

• Better search bar with suggestions!

• Key information in results with custom displays. 

• Paths which are easy to share and navigate.
Options to improve
experience
Making improvements
Configure search page
Search page options
• How many results?

• Enable spell check?

• Show search box?

• Enabled Facets?
Facet block placement
• Double check your facet block configuration. 

• Where to display? Search box in header?
Demo: Apache Solr
Autocomplete
• Enable Apache Solr Auto Complete.

• Uses stemming so verb forms are picked up
as well.

• Becoming standard, what users want.
Demo: Rich snippets
• Replicates Google’s results; Needs RDF!
Tip: If you install
this during demo,
please ensure to
disable this for
next exercise
Demo: Search page
configuration
• Where you configure Pages/blocks

• Demo how to change options
Next: Manage display
• Control the display for “Search results”

• Limited options; only fields
Display Suite for
Search results
Display Suite!
• Display Suite +
Display Suite Search !
• (and Display Suite UI)!
• Custom layout!
• Select which fields to
display!
• Multiple columns,
headers and footers.
Example
Header
Left
Footer
Right
Display suite
• Access items which aren’t “fields”
View modes
• Add “view modes” for specific control
Display Suite regions
• Variety of layouts
Arrange fields in regions
Demo: Display Suite
• Enable Display Suite, Display Suite Search,
Display Suite UI

• Modify display and change layout for
“Search result” 

• Show what “Search index” provides.
Exercise 5: Improve display
with Display Suite
• Manage display, Choose relevant fields
SECTION 6:
CUSTOM CODE -
PROXIMITY SEARCH
Example of custom code
Display location
search results
Location data in search
• Takes the
coordinates
of the search,
and returns
to the query.
Demo: Location results
• Use Display Suite to display a location on a
Map. 

• Which modules work best

• Tips about handling Location data

!
• A custom code example- using location as a
factor in search.

• Search training Location module

• Location Search module
Exercise 6: Display
location results
• Requires: The Display Suite modules, GMap,
GMap Location, Geocoder.
SECTION 7:
ENHANCEMENTS
If time allows!
Indexing files such as
PDF or DOCX
Search file attachments
Search files
• Document search!
• Server requirements
Demo: Attachment search
• Assumes you’re using Acquia’s search
service 

• Enable Apache Solr search attachments
ANY QUESTIONS?
Feedback please!
http://acquia.com/training-feedback

More Related Content

Apache Solr Search Course Drupal 7 Acquia