Hibernating Rhinos Ltd
Oren Eini l CEO l Mobile: + 972-52-548-6969
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ravendb/Ivmi6OBKH5k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ravendb+unsubscribe@googlegroups.com.
public class TestIndex : AbstractMultiMapIndexCreationTask<IndexState> { public TestIndex() { AddMap<JobProductionEvent>(productionEvents => from pe in productionEvents select new IndexState { OrdId = pe.OrdId, LineItems = new [] { new { ItmId = pe.ItmId, TotalFt = 0, GoodFt = pe.GoodIn / 12, QuantityDone = pe.Quantity, Quantity = 0 } } OneLine = new StateLine() }); AddMap<Job>(jobDetails => from job in jobDetails select new IndexState { OrdId = job.OrdId, LineItems = job.Items.Select(i => new StateLine() { ItmId = i.ItmId, GoodFt = 0m, TotalFt = i.Length * i.Quantity / 12, QuantityDone = 0, Quantity = i.Quantity } }); Reduce = jobStates => from js in jobStates group js by new {js.OrdId} into g select new IndexState { OrdId = g.Key.OrdId, LineItems = g.SelectMany(x => x.LineItems) .GroupBy(x => x.ItmId) .Select(gx => new StateLine() { ItmId = gx.Key, GoodFt = gx.Sum(x => x.GoodFt), TotalFt = gx.Sum(x => x.Length) * gx.Sum(x => x.Quantity) / 12, QuantityDone = gx.Sum(x => x.QuantityDone), Quantity = gx.Sum(x => x.Quantity) } ) OneLine = new StateLine() }; }