incubator-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 04:52:50 GMT
Well, it all depends on what data you allow in the db.
If the job location is just stored as a freeform text field, then users 
can and will write anything in there.

If you have categorical data like location, then perhaps your job entry 
forms should have a multi-select form field instead of just text?


On 30/03/2011 2:23 PM, Andrew Stuart (SuperCoders) wrote:
> 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
>>

Mime
View raw message