MapReduce query returns case_clause badmatch?

Jonathan Langevin jlangevin at loomlearning.com
Fri Jul 15 14:07:03 EDT 2011


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 - jlangevin at loomlearning.com -
www.loomlearning.com - Skype: intel352
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110715/e5a5bf73/attachment.html>


More information about the riak-users mailing list