Querying Examples

Jason Tanner jt4websites at googlemail.com
Wed Feb 3 17:57:05 EST 2010


Im trying to work out how, using riak's *erlang* *map reduce* *Interface* I
would do something equivalent to the following SQL:

    FROM Users
 WHERE age < 50
      AND  home_town = "London"

So assuming I had a bucket "Users" keyed on some unique user-id where the
object value associated with the users key was structured something like:

[ {first_name, "Bob"},
  {last_name, "Smith" },
  {age,           30 },
  {home_town, "London" } ]

(Lets also assume that the "Users" bucket contains several thousand user
key/value entries, and I want to produce a subset of them based on the
filter criteria above in the SQL)

What could my erlang map function look like ?
What could my erlang reduce function look like ?

Unfortunately, all the examples I have been able to find, seem to be related
to counting and accumulating entries.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20100203/4df6909b/attachment.html>

More information about the riak-users mailing list