Jonathan, Riak cannot run a map phase that takes anything other than bucket/key[/keydata] inputs, so returning [value] from your first map phase is invalid. Instead, just return [1] if your regexp test passes.
On Fri, Jul 15, 2011 at 2:07 PM, Jonathan Langevin < jlange...@loomlearning.com> wrote: > When running several maps and one reduce against a bucket, I'm getting an > error, info is below. > Any idea what I'm doing wrong? > > Data submitted (printed as php-style array): > array > ( > 'inputs' => 'Course' > 'query' => array > ( > '0' => array > ( > 'map' => array > ( > 'keep' => false > 'language' => 'javascript' > 'arg' => null > 'source' => 'function(v){return [v];}' > ) > ) > '1' => array > ( > 'map' => array > ( > 'keep' => false > 'language' => 'javascript' > 'arg' => null > 'source' => ' > function(value){ > if(!value.not_found) { > var object = Riak.mapValuesJson(value)[0]; > var val = object[\"idNumber\"].toLowerCase(); > if((val.match(/lbst/))) { > return [value]; > } > } > return []; > } > ' > ) > ) > '2' => array > ( > 'map' => array > ( > 'keep' => false > 'language' => 'javascript' > 'arg' => null > 'source' => 'function(){return [1]}' > ) > ) > '3' => array > ( > 'reduce' => array > ( > 'keep' => true > 'language' => 'javascript' > 'arg' => null > 'name' => 'Riak.reduceSum' > ) > ) > ) > ) > > > And here is the [start of] the response I get, below. > What's interesting is, I also get back the results of my query (or at > least, the contents of the bucket...). > > array > ( > 'headers' => array > ( > 'http_code' => 500 > 'server' => > 'MochiWeb/1.1 WebMachine/1.7.3 (participate in the frantic)' > 'date' => 'Fri, 15 Jul 2011 18:02:25 GMT' > 'content-type' => 'text/html' > 'content-length' => '2453' > ) > 'body' => > '<html><head><title>500 Internal Server > Error</title></head><body><h1>Internal Server Error</h1>The server > encountered an error while processing this request:<br><pre>{error, > {error, > {case_clause, > {{badmatch, > {struct, > [{<<\"bucket\">>,<<\"Course\">>}, > {<<\"key\">>, > ..... > * > > > <http://www.loomlearning.com/> > Jonathan Langevin > Systems Administrator > Loom Inc. > Wilmington, NC: (910) 241-0433 - jlange...@loomlearning.com - > www.loomlearning.com - Skype: intel352 > * > > _______________________________________________ > riak-users mailing list > riak-users@lists.basho.com > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > > -- Sean Cribbs <s...@basho.com> Developer Advocate Basho Technologies, Inc. http://www.basho.com/
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com