Reputation: 6271
I've got 2 views with CI: Header and Content.
In my controller I load my header, execute a query and then load this into the controller. This is bringing back all my content.
However, I have a search bar in my Header, what I'd like it to do is when the user is typing, I would like it to filter the content on the page as they type.
Is there anyway to do this without constantly executing database queries?
Upvotes: 0
Views: 278
Reputation: 77966
Yes, you make one database query and cache all the results, and then use autocomplete to query your cache store. Depending on the searchable content this may or may not be feasible. If you have a giant dataset with several million records, it would make more sense to rely on database cache like Memcached - if you're searching geo locations or something similar you might want to rely on Ajax API calls to a Solr instance.
Upvotes: 1