Facet Searching using Ultrasphinx

  • 5,332 views
Uploaded on

 

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
5,332
On Slideshare
0
From Embeds
0
Number of Embeds
3

Actions

Shares
Downloads
0
Comments
0
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1.
    • Faceted browsing
    • using
    • UltraSphinx
  • 2. About me
    • A passionate rails developer
    • Author of
      • Rails plugin State Select
      • Bash and ruby utility scripts
    • Work with Vinsol
    • Blog: http://webonrails.com
  • 3. Traditional Search Tools
    • Designed to retrieve information
    • Situations in which the user knows exactly what he wants
    • Perform quite badly in most real situations
      • Buying a digital camera
      • Finding a Job
      • Selecting a photo
      • Finding a restaurant
  • 4. Facets?
    • Attributes of an Object in various categories
    • Examples:
      • Music catalog: songs have attributes such as album, artist, title, length, date...
      • Recipes: cuisine, main ingredients, cooking style...
      • Content Site: articles have authors, dates, category, tags...
      • Image collection: artist, date, style, type of image, major colors, theme...
  • 5. Faceted Search
    • Drilling down search results using dynamic taxonomies called Facets
  • 6. Faceted Search
    • Includes exposing the facets in dynamic taxonomies
    • Allows user
      • To see exact options they have available to drill down the result
      • To switch easily between searching and browsing, using their own terminology for search
  • 7. Features Faceted Search
    • Displaying various aspects of the current results set in multiple categorizations
    • Showing only populated categories, no dead-ends (links leading to empty lists)
      • To see exactly the options they have available at that time
      • Displaying a count of the contents of each category
  • 8. When we need Faceted Search?
    • User need to filter content using multiple taxonomy terms
    • User want to combine text searches, taxonomy term filtering, and other search criteria
    • User don't know precisely what they can find on your site, or what to search for
    • Users often get empty result sets when searching your site
    • Site has too much content for it to be displayed through fixed navigational structures
    • "advanced" search forms are not fun to use
  • 9. Quick look at Ultrasphinx features
    • Searching and ranking across multiple models
    • Delta index support
    • Excerpt highlighting
    • Google-style query parser
    • Spellcheck
    • Faceting on text, date, and numeric fields
    • Field weighting, merging, and aliasing
    • Belongs_to and has_many includes
    • Drop-in compatibility with will_paginate
  • 10. Indexing Data
    • Article Model
    • is_indexed :fields => [
                • 'created_at',
                • 'title',
                • {:field => 'body', :as => 'description'},
                • {:field => 'category', :facet => true, :as => 'category_name' }
    • ],
    • :conditions => "status = 'published' ",
    • :include => [{:association_name => 'Author', :field => 'name', :as => 'author_name'}]
  • 11. Preparing index withUltrasphinx
    • rake ultrasphinx:configure
    • rake ultrasphinx:index
    • rake ultrasphinx:daemon:start
  • 12. Running Queries
    • @search = Ultrasphinx::Search.new(:query => @query, :class_names => 'Article', :per_page => 20)
    • @search.run
    • @search.results
  • 13. Lets do it practically
  • 14. Use Case
    • We have a Product model and we want to implement search on its various fields. Also we want to use its brand, category and celebration* as facets.
    * Occassion when a product can be used
  • 15. Product Model
    • is_indexed :fields => [ :description, :name,
    • {:field => :celebration, :facet => true}
    • ],
    • :include => [
    • { :association_name => 'brand', :field => 'name', :facet=>true, :as => 'brand',
    • :association_sql => "left outer join brands brand on products.brand_id =
    • brand.id"
    • },
    • { :class_name => "Category", :field => 'title', :facet=>true, :as => 'category',
      • :association_sql => "left outer join categories on category.id =
      • products.category_id"}
    • ]
  • 16. Prepare index and start search daemon
    • rake ultrasphinx:configure
    • rake ultrasphinx:index
    • rake ultrasphinx:daemon:start
    • * remember to restart app server
  • 17. Search Controller
    • @query = params[:query] || “”'
    • @filters = params[:filters] || '””
    • @page = params[:page] || 1
    • @search = Ultrasphinx::Search.new(:query => @query+" "+@filters, :facets => ["category", "brand", "celebration"], :page => @page, :class_names => 'Product')
    • @search.run
    • @products = @search.results
  • 18. View
  • 19. Output
  • 20. References
    • UltraSphinx
      • http://blog.evanweaver.com/files/doc/fauna/ultrasphinx
    • Sphinx
      • http://sphinxsearch.com/
  • 21.
    • Thanks a lot
    • :-)