Skip to content

Spree Extension that searches for terms that match all keywords in search

License

Notifications You must be signed in to change notification settings

entropillc/spree_like_all_searcher

Repository files navigation

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

About

Spree Extension that searches for terms that match all keywords in search

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages