Facet Searching using Ultrasphinx

100 %
0 %
Information about Facet Searching using Ultrasphinx
Technology

Published on November 24, 2008

Author: bansalakhil

Source: slideshare.net

Faceted browsing using UltraSphinx

Faceted browsing

using

UltraSphinx

About me A passionate rails developer Author of Rails plugin State Select Bash and ruby utility scripts Work with Vinsol Blog: http://webonrails.com

A passionate rails developer

Author of

Rails plugin State Select

Bash and ruby utility scripts

Work with Vinsol

Blog: http://webonrails.com

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

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

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...

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...

Faceted Search Drilling down search results using dynamic taxonomies called Facets

Drilling down search results using dynamic taxonomies called Facets

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

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

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

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

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

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

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

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

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'}]

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'}]

Preparing index withUltrasphinx rake ultrasphinx:configure rake ultrasphinx:index rake ultrasphinx:daemon:start

rake ultrasphinx:configure

rake ultrasphinx:index

rake ultrasphinx:daemon:start

Running Queries @search = Ultrasphinx::Search.new(:query => @query, :class_names => 'Article', :per_page => 20) @search.run @search.results

@search = Ultrasphinx::Search.new(:query => @query, :class_names => 'Article', :per_page => 20)

@search.run

@search.results

Lets do it practically

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

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.

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"} ]

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"}

]

Prepare index and start search daemon rake ultrasphinx:configure rake ultrasphinx:index rake ultrasphinx:daemon:start * remember to restart app server

rake ultrasphinx:configure

rake ultrasphinx:index

rake ultrasphinx:daemon:start

* remember to restart app server

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

@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

View

Output

References UltraSphinx http://blog.evanweaver.com/files/doc/fauna/ultrasphinx Sphinx http://sphinxsearch.com/

UltraSphinx

http://blog.evanweaver.com/files/doc/fauna/ultrasphinx

Sphinx

http://sphinxsearch.com/

Thanks a lot :-)

Thanks a lot

:-)

Add a comment

Related presentations

Related pages

Presented faceted search using ultrasphinx | WebOnRails

Presented faceted search using ultrasphinx ... Facet Searching using Ultrasphinx. View SlideShare presentation or Upload your own. (tags: sphinx ultrasphinx)
Read more

Presented faceted search using ultrasphinx | Vinsol

Presented faceted search using ultrasphinx. Posted by Akhil Bansal ... Facet Searching using Ultrasphinx. View SlideShare presentation or Upload your own.
Read more

Faceted Search With Sphinx - ioncannon.net

The same search query is then run again with a grouping for each facet you ... Using Rails UltraSphinx ... One thought on “ Faceted Search With Sphinx ...
Read more

solr | Vinsol

Facet Searching using Ultrasphinx View SlideShare presentation or Upload your own. (tags: sphinx ultrasphinx) You can ask me if you have any doubt.
Read more

Sphinx | Open Source Search Engine

Sphinx is an open source full text search server, designed with performance, relevance (search quality), and integration simplicity in mind.
Read more

Facet& | LinkedIn

View 58168 Facet& posts, presentations, experts, and more. Get the professional knowledge you need on LinkedIn.
Read more

Facet | LinkedIn

View 58710 Facet posts, presentations, experts, and more. Get the professional knowledge you need on LinkedIn.
Read more

GitHub - sunspot/sunspot: Solr-powered search for Ruby objects

Each facet returns zero or more rows ... Sunspot can extract related items using more_like_this. When searching for ... includes comparison of Sunspot and ...
Read more