RavenDb 報錯 has already produced 16 map results for a source document 解決方案
阿新 • • 發佈:2018-09-30
add default pla eas ask document cti def purchase
今天發現 RAVenDb 數據庫報告錯誤
Index ‘OrderTicketIssueReportIndex‘ has already produced 16 map results for a source document ‘ff0ff6ed-2eab-4fba-8a61-a1b85d9e14cb‘, while the allowed max number of outputs is 15 per one document. Please verify this index definition and consider a re-design of your entities or index.
經過研究, Oren Eini 給出原因和解決方案,
通過 RavenDb Studio 解決方法:
Go to Add > Max Inputs in the index edit screen.
通過代碼解決的方案, 在建立索引時, 添加屬性:
1 public class OrderTicketIssueReportIndex : AbstractIndexCreationTask<Order> 2 { 3 public OrderTicketIssueReportIndex() 4 { 5 MaxIndexOutputsPerDocument = 300; // 通過這個設置, 讓服務器索引每文檔內子對象超過16個的默認限制 6 7 Map = orders => 8 from order in orders 9 from itin in order.Itineraries 10 where string.IsNullOrEmpty(itin.TicketNumber) == false && itin.PurchaseIssueId.HasValue 11 let firstItin = (fromi in order.Itineraries 12 where i.TicketNumber == itin.TicketNumber 13 orderby i.Flight.DepartureDate ascending 14 select i).FirstOrDefault() 15 let purchaseIssue = LoadDocument<PurchaseIssue>(itin.PurchaseIssueId.ToString()) 16 select new OrderTicketIssueReportIndexModel 17 { 18 PlaceOrderTime = order.PlaceOrderTime, 19 DepartureDate = itin.Flight.DepartureDate,
RavenDb 報錯 has already produced 16 map results for a source document 解決方案