We have an object with nested properties that we want to make easily searchable. It was simple enough to achieve, but we also want to collect information based on several fields. In terms of the domain, we have several transactions that have the same information, except for the seller. We need to combine them as one result and show the sellerβs parameters on the next page. However, we still need to be able to filter based on the seller on the start page.
We tried to do something like the following to try to collect several sellers in a row, but they contain duplicates, and creating an index takes forever.
Map = deals => deals.Select(deal => new { Id = deal.ProductId, deal.ContractLength, Provider = deal.Provider.Id, Amount = deal.Amount }); Reduce = deals => deals.GroupBy(result => new { result.ProductId, result.ContractLength, result.Amount }).Select(result => new { result.Key.ProductId, result.Key.ContractLength, Provider = result.Select(x => x.Provider).Distinct(), result.Key.Amount });
I'm not sure if this is the best way to deal with this problem, but pretty new to Raven and struggling for ideas. If we keep the index simple and group on the client side, we will not be able to maintain the swap sequence.
Any ideas?
source share