Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Instant-style search in Rails3

In my Rails app, I want to an incremental search (like autocomplete) through the Customer table in the DB, looking for names, and showing the results as you type, Google Instant-style.

My brief research for gems or examples that might help in this scenario didn't provide any useful results.
Is there a Rails way to implement this?


The only issue I can think of is that that having approx. 500k records in the DB (even if the name related columns are indexed) might slow down the responsiveness.
As a solution for that, the ajax request might be triggered only after typing in the first 4-5 characters.

Any other suggestions, leads, issues, ideas, comments?

like image 645
Marius Butuc Avatar asked Jan 20 '23 11:01

Marius Butuc


1 Answers

Use this: Tokeninput

and here is Railscast for it: TokenInput railscast

like image 126
bor1s Avatar answered Jan 29 '23 09:01

bor1s