couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Stuart (SuperCoders)" <andrew.stu...@supercoders.com.au>
Subject Re: Recommendations for how to do faceted search in CouchDB
Date Wed, 30 Mar 2011 03:23:35 GMT
thanks Patrick

A question - does this technique also work if for example a job  
appears in multiple locations (melbourne & sydney), or it appears in  
multiple categories i.e. developers/software engineers/web programmers

thanks

andrew


On 30/03/2011, at 2:13 PM, Patrick Barnes wrote:

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
>
-- 
Message  protected by MailGuard: e-mail anti-virus, anti-spam and  
content filtering.http://www.mailguard.com.au/mg
Click here to report this message as spam:
https://login.mailguard.com.au/report/1C0dI02ork/6l9Om021I5Tc7F2B3vVGlU/0

Mime
View raw message