Rails: do a search / filter like Amazon.com

I am trying to implement a search function on a model based on several attributes. I want the user to be able to specify which attributes to filter. This would be very similar to any e-commerce site such as Amazon.com

For example, a user can filter based on - author - rating - category

Any advice would be greatly appreciated!

+3
source share
4 answers

Solr , Sunspot Ruby/Rails Solr.

, :

# Posts that match 'pizza' returning counts for each :author_id
search = Post.search do
  fulltext "pizza"
  facet :author_id
end

search.facet(:author_id).rows.each do |facet|
  puts "Author #{facet.value} has #{facet.count} pizza posts!"
end

Sunspot Rails Solr save.

+2

, , ​​ Solr, ElasticSearch, : https://github.com/fortytools/forty_facets

+1

All Articles