EE Autocomplete Search


For a recent project I had to implement an autocomplete function into Expression Engine’s search module. As always the most important rule was not to touch the core at all and make installation and usage as easy as possible.

It does not interfere with any other extensions and supports Transcribe (Multi-Lang), Structure and all search options. The library handling representation of search results is Twitter’s Typeahead in combination with Bloodhound. It’s production-ready but nevertheless take care when deploying.Typeahead’s implementation is pretty straight forward by injecting its library and create a new instance with basic configuration options.

EE’s search module is pretty basic and something (I don’t remember what exactly) made it not usable at first. It was only a small issue so I wrote a wrapper to handle this issue. This wrapper accepts all parameters of the search-module.

Typeahead is expecting well-formed JSON-data as a response so all EE-templates need to be of type “Javascript” and the contents of {exp:search:search_results} need to output in valid JSON. Your browser’s “Developer Tools” and will help to find issues within JSON

Link to Github Repository:  EE Autocomplete Search


Leave a Reply

Your email address will not be published. Required fields are marked *