Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MapReduce Index and GetObjects<T>
using System;
using System.Linq;
using System.Threading;
using System.Web;
using CorrugatedIron;
using CorrugatedIron.Comms;
using CorrugatedIron.Config;
using CorrugatedIron.Models;
using CorrugatedIron.Models.MapReduce;
using CorrugatedIron.Models.MapReduce.Inputs;
using CorrugatedIron.Util;
using CorrugatedIron.Extensions;
namespace TestMapReduce
public class UserInfo
public string Email { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string CompanyId { get; set; }
internal class Program
private static void Main(string[] args)
IRiakEndPoint Cluster;
IRiakClient Client;
IRiakClusterConfiguration ClusterConfig;
const string MrContentType = RiakConstants.ContentTypes.ApplicationJson;
ClusterConfig = RiakClusterConfiguration.LoadFromConfig("riakLoadTestConfiguration");
Cluster = new RiakCluster(ClusterConfig, new RiakConnectionFactory());
Client = Cluster.CreateClient();
var user = new UserInfo {CompanyId = "corp", Email = "", FirstName = "jeremiah", LastName = "peschka"};
var o = new RiakObject("test", user.Email, user);
o.AddBinIndex("email", user.Email);
var input = new RiakBinIndexEqualityInput("test", "email_bin", user.Email);
var mr = new RiakMapReduceQuery {ContentType = MrContentType};
.MapJs(m => m.Name("Riak.mapValuesJson")
var result = Client.MapReduce(mr);
var phases = result.Value.PhaseResults;
var infos = phases.Last().GetObjects<UserInfo[]>().First();
var info = infos[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment