码迷,mamicode.com
首页 > 数据库 > 详细

RavenDb 报错 has already produced 16 map results for a source document 解决方案

时间:2018-09-30 14:53:30      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:默认   解决方法   原因   select   class   erb   source   tostring   edit   

今天发现 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 = (from i 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 解决方案

标签:默认   解决方法   原因   select   class   erb   source   tostring   edit   

原文地址:https://www.cnblogs.com/nepton/p/9729077.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!