couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Chris Anderson <jch...@gmail.com>
Subject Re: Simple autocomplete
Date Sun, 11 Apr 2010 16:11:56 GMT

On Apr 8, 2010, at 10:17 AM, faust 1111 wrote:

> I need simple autocomplete for tags
> can i implement this with view or i need lucent?
> Content
>  has tags
> 
> when moderator need add tag he use autocomplete by all exists tags.

A view is actually perfect for this because it does a prefix sort, so you can use what the
person has typed as the start key.

maybe 

_view/tags?startkey="tec"&endkey="tec\u9999"

the \u9999 is just a character that is probably after all the chars in your tag. if you want
something less hackish, you can emit all your tags as single element arrays, and have this:

_view/tags?startkey=["tec"]&endkey=["tec",0]

Either one should give you the tags

tech
technology
tectonic

which is what you want for an autocomplete.

If you get this working and can share code, I'd be keen to add it to my blog software.

Chris
Mime
View raw message