Hi Arun Your question is fairly similar to the one in the latter half of this thread http://n2.nabble.com/reduce_limit-error-td2789734.html#a2789734 It may be worth looking at for your answer.
Paul On Tue, Aug 18, 2009 at 4:57 PM, Arun Thampi<[email protected]> wrote: > Hi guys - I have the following reduce function which returns a result object > where each value is an object (instead of an array). Basically I'm trying to > get the text value of a thread and the number of associated replies. However > when the length of the string which is stored in the text property is large, > I hit the reduce_limit. The same thing happens when I try to add more > properties to the result object. The view is queried like so: > http://localhost:5984/icanhazthread/_design/icanhazthread/_view/threads_with_num_replies?group_level=1 > I > guess my question boils down to whether this is a 'good' reduce function? I > remember Jan mentioning in another thread that we should not be converting > tall lists to wide lists, but since the result of this reduce function > contains objects instead of arrays of objects, I'm not sure whether its the > same as converting from tall -> wide lists. Please correct me if I've missed > something. (For now i've disabled reduce_limit and it seems to be working > fine). > > As always, thanks for the help! > > Cheers, > Arun > > Reduce Function: > > function(keys, values, rereduce) { > var result = { num_replies: 0, text: "" }; > > if(rereduce) { > for(idx = 0; idx < values.length; idx++) { > result.num_replies += values[idx].num_replies; > result.text = values[idx].text; > } > } else { > > for(idx = 0; idx < values.length; idx++) { > if(values[idx].type == 'thread') { > result.text = values[idx].text; > } else if(values[idx].type == 'reply') { > result.num_replies += 1; > } > } > } > > return result; > } > > -- > It's better to be a pirate than join the Navy - Steve Jobs > http://mclov.in >
