Skip to content

Latest commit

 

History

History
26 lines (15 loc) · 969 Bytes

README.rdoc

File metadata and controls

26 lines (15 loc) · 969 Bytes

SpreeLikeAllSearcher

By default, Spree searches for terms in a “Like Any” fashion. For example, if you searched for “2006 Mustang”, Spree would break this search in to an array

["2006", "Mustang"]

then it would find all products that have the word “2006” or “Mustang”. In some sites this may not be optimal, because you want to narrow the results down to include both terms.

The Spree Like All Searcher takes the array and will find either both terms in the Title or description, such that the generated where clause in the SQL looks like this:

(
  `spree_products`.name LIKE '%2006%' 
    AND `spree_products`.name LIKE '%Mustang%' 
    OR `spree_products`.description LIKE '%2006%' 
    AND `spree_products`.description LIKE '%Mustang%'
)

Installation

Add the following to your Gemfile

gem 'spree_like_all_searcher', :git => '[email protected]:entropillc/spree_like_all_searcher.git'

Run bundle install, and you should be golden