RESTful autocompletion and search


I want to be able to do autocompletion and search while using the new
RESTful “API”. I figured that, as autocompletion is basically the same
as search, these can be done in one action, and that that action is
index; passing a parameter to say what we’re looking for and determining
if the user wants html (plain search) or if they want js

However, I’ve been unable to come up with a good scheme for doing this
and I was wondering how other people have solved this problem.