couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harold Cooper <har...@mit.edu>
Subject two view questions: group=true, inverted indices
Date Sun, 07 Feb 2010 23:15:40 GMT
Hi there,

I'm new to CouchDB and have two questions about the use of mapreduce
in views.

1.
As far as I can tell, even when I pass group=true to a view,
reduce(keys, values) is still passed different keys,
e.g. keys = [["a", "551a50e574ccd439af28428db2401ab4"],
["b", "94d13f9e969786c6d653555a7e94f61e"]].

Isn't the whole point of group=true that this shouldn't happen?


2.
When I've read about mapreduce before, a classic example use is
constructing an inverted index. But if I make a view like:
{
map: "function(doc) {
  var words = doc.text.split(' ');
  for (var i in words) {
    emit(words[i], [doc._id]);
  }
}",
reduce: "function(keys, values) {
  // concatenate the lists of docIds together:
  return Array.prototype.concat.apply([], values);
}"
}
then couchdb complains that the reduce result is growing too fast.

I did read that this is the way things are, but it's too bad because
it would be a perfect application of mapreduce, and the only other
text search option I've heard of is couchdb-lucene which doesn't
sound nearly as fun/elegant.

Is there another way to approach this?
Should I just not reduce and end up with one row per word-occurrence?

Thanks for any help,
and sorry if this has been covered before, I did try to search around first.
--
Harold

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message