couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <>
Subject Re: handling keys in the REST view API
Date Fri, 29 May 2009 19:12:41 GMT
On Fri, May 29, 2009 at 2:47 AM, Peter Maas <> wrote:
> Hi,
> I'm trying to write a very basic fulltext search facility and managed to get
> something working:
> Currently I sanitize the source text, remove stopwords (English that is) and
> emit a each term (with the number of occurences). Quite useful (for me)
> already.
> The next step would be to add stemming, not to hard either (have a working
> prototype already). This does however present me with a new problem. I'd
> like to stem the provided keys in the REST parameters using the same stemmer
> used by the mapping code. Is there a way to process the parameters passed to
> a REST view within CouchDB? Or would I need to duplicate (port) the stemmer
> in the clients (which are various in various languages)?

The simplest thing to do is run the stemming on the client. If you
wanted to keep the stem algorithms only in JS, you could make hackish
use of a _show function to take params and return stemmed versions of
them to the client for use. This becomes less hackish if you keep the
logic in the _show function but any necessary dictionary in a
document. Then you can have a dictionary per language, each in it's
own document.

> kind regards,
> Peter

Chris Anderson

View raw message