我刚刚开始使用Raven,并且我创建的索引一直未能为任何索引编制索引。我发现很多看起来像这样的乌鸦服务器上的错误:RavenDB索引错误
{
Index: "HomeBlurb/IncludeTotalCosts",
Error: "Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?)",
Timestamp: "2012-01-14T15:40:40.8943226Z",
Document: null
}
我创建看起来像这样的指标:
public class HomeBlurb_IncludeTotalCosts : AbstractIndexCreationTask<MPDocument, HomeBlurb_IncludeTotalCosts.ReduceResult>
{
public class ReduceResult
{
public string Name { get; set; }
public string Constituency { get; set; }
public decimal AmountPaid { get; set; }
}
public HomeBlurb_IncludeTotalCosts()
{
Map = mps => from mp in mps
from expense in mp.Expenses
select new
{
mp.Name,
mp.Constituency,
AmountPaid = expense.AmountPaid ?? 0M
};
Reduce = results => from result in results
group result by new { result.Name, result.Constituency }
into g
select new
{
g.Key.Name,
g.Key.Constituency,
AmountPaid = g.Sum(x => x.AmountPaid)
};
}
}
该指数是由乌鸦创建(看它通过Raven Studio)并且看起来很好。
真正引发我的是,我使用的文件不包含任何双打或整数,我存储的唯一数字是小数。
什么可能导致问题?
哪个构建您使用:
替换为这个?我只是在一个使用573的小型演示中尝试过你的索引,它没有任何问题,没有看到任何索引错误。 – 2012-01-14 16:24:50
我也使用573。 – ilivewithian 2012-01-14 16:44:25
我删除并替换了所有的项目引用,重建客户端,重新启动服务器并重新导入数据,现在看起来一切正常。 – ilivewithian 2012-01-14 17:04:09