Reputation: 3308
I have a rails app that uses the following,
Now, this app does nothing but handles a products catalog. When I say products catalog, not just a simple one. It handles, all the features, categories, brands.
There is a master text search functionality on all the product titles and features listed in 2 mysql tables. TITLES and FEATURES. Search is working fine and relevant.
Should I use a gem or build it from scratch?. please give your reason
If I should use a gem, which one to use, does that gem is up to date and has a forum to support anytime?.
We think, auto-complete/suggest on "titles" table would be fine when compared to adding auto-complete/suggest on both "titles" and "features" tables. Your comments on that?
What is it, auto-suggest or auto-complete?
(Like, there is PAT ALLAN and BARRY HUNTER for thinking sphinx and sphinx search,Gosh! its their dedication to support that make users sleep sound)
I stated the elements of my app in detail, please advice me !
Thanks!
Upvotes: 3
Views: 3141
Reputation: 1684
jqueryui is a great resource.
here is a demo of autocomplete, you can view the source to see how to implement on your server. http://jqueryui.com/demos/autocomplete/
the javascript sends a term=TERM to your controller. Mine is setup like this:
def autocomplete
@movies= Movie.select("id, title").where("title LIKE ?", "#{params[:term]}%").limit(20)
@hash = []
@movies.each do |movie|
@hash << {"label" => movie.title, "id" => movie.id}
end
render :json => @hash
end
customize to how you see fit.
Upvotes: 5