For a general autocomplete suggestion (lexicographically sorted keys) one could use tries or TSTs. However I would like to do autocomplete to return results based on popularity of results. So searching for "clinton" would show "bill clinton", "hillary clinton" and "chelsea clinton" in that order. I believe this can be done using ngram approach within Lucene. Are there any other ways to do it?
On a similar note, what's the backend to return a list of results for the tags autocomplete on stackoverflow? Is it lucene based?