couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Barnes <mrtr...@gmail.com>
Subject Re: Recommendations for how to do faceted search in CouchDB
Date Wed, 30 Mar 2011 03:13:32 GMT
You can do that with a single view:

In the map, emit for each field key [fieldname,fieldvalue] and value null.
In the reduce, set it to '_count' (instead of a js function) to use the 
fast built-in reduce.

Then you can query that view with 
startkey=[fieldname]&endkey=[fieldname,{}]&group=true to see all the 
values in that field.

You don't really need _count, but that might be useful if you wanted to 
have some minimum of how many times a term is used before you include it.

-Patrick

On 30/03/2011 1:50 PM, Andrew Stuart (SuperCoders) wrote:
> hi folks
>
> What's the best way to do facted search in CouchDB?
>
> For example consider a jobs website where the user selects from dropdown
> lists to narrow the search location/industry/job title i.e. melbourne/IT
> industry/software engineer or sydney/accounting/bookkeeper
>
> It doesn't seem practical to create a view for every combination of the
> dropdown lists.
>
> any suggestions as to the best way to do this?
>
> thanks
>

Mime
View raw message