You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by faust 1111 <fa...@gmail.com> on 2010/04/08 19:17:23 UTC

Simple autocomplete

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.

Re: Simple autocomplete

Posted by Mirsal Ennaime <mi...@gmail.com>.
On Thu, Apr 8, 2010 at 7:17 PM, faust 1111 <fa...@gmail.com> wrote:
> I need simple autocomplete for tags
> can i implement this with view or i need lucent?

IMHO, you should use couchdb-lucene.

-- 
Mirsal

Re: Simple autocomplete

Posted by "Jim R. Wilson" <wi...@gmail.com>.
You could use a view for substring matching as well - I'm currently
working on a couchapp in which I was planning on doing just that.

-- Jim R. Wilson (jimbojw)

On Sun, Apr 11, 2010 at 12:55 PM, Mirsal Ennaime
<mi...@gmail.com> wrote:
> On Sun, Apr 11, 2010 at 6:11 PM, J Chris Anderson <jc...@gmail.com> wrote:
>> 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.
>
> Right !
> I thought he wanted to match substrings.
> (in a way that "tec" would also match "nanotech")
>
> --
> Mirsal
>

Re: Simple autocomplete

Posted by Mirsal Ennaime <mi...@gmail.com>.
On Sun, Apr 11, 2010 at 6:11 PM, J Chris Anderson <jc...@gmail.com> wrote:
> 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.

Right !
I thought he wanted to match substrings.
(in a way that "tec" would also match "nanotech")

-- 
Mirsal

Re: Simple autocomplete

Posted by J Chris Anderson <jc...@gmail.com>.
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