I have a problem and hope to get an answer from you :-)
So, I took geonames.org and imported all their data of German cities with all districts.
If I enter \
If I understand your problem right, probably all you need is already built in the CouchDB.
startkey="Ham"&endkey="Ham\ufff0"Here is a view function to make this:
function(doc) {
for (var name in doc.places) {
emit(name, doc._id);
}
}
Also see the CouchOne blog post about CouchDB typeahead and autocomplete search and this discussion on the mailing list about CouchDB autocomplete.