Mapreduce RavenDB索引中的奇怪日期格式
索引中的日期格式有问题。他们是 序列化为不可序列化的内容。我们的实体拥有这样的能力 形状: 文档已正确序列化:Mapreduce RavenDB索引中的奇怪日期格式,mapreduce,ravendb,Mapreduce,Ravendb,索引中的日期格式有问题。他们是 序列化为不可序列化的内容。我们的实体拥有这样的能力 形状: 文档已正确序列化: publications/806059ce-fd7a-4655-8e0e-9fff00f5ebd3 { ... "SuggestedActiveRange": { "StartDate": "2011-11-22T00:00:00.0000000Z", "EndDate": "2012-01-22T00:00:00.0000000Z", "T
publications/806059ce-fd7a-4655-8e0e-9fff00f5ebd3
{
...
"SuggestedActiveRange": {
"StartDate": "2011-11-22T00:00:00.0000000Z",
"EndDate": "2012-01-22T00:00:00.0000000Z",
"TimeSpan": "61.00:00:00"
},
"ActualActiveRange": {
"StartDate": "2011-11-22T00:00:00.0000000Z",
"EndDate": "2012-01-22T00:00:00.0000000Z",
"TimeSpan": "61.00:00:00"
},
...
}
我将我的索引定义为这样(它是一个多重缩减):
这几乎就像是在对这些日期进行哈希运算。也许我没有安装
我的野外存储正确吗?如果我显式地调用.ToString(“u”),它
将以可反序列化的格式存储日期,但不能
与我想要的格式相当,而且太混乱了。@amoss我会尝试将你的问题发布到RavenDB Google群组。Ayende和其他Raven人监视该用户组。
publications/806059ce-fd7a-4655-8e0e-9fff00f5ebd3
{
...
"SuggestedActiveRange": {
"StartDate": "2011-11-22T00:00:00.0000000Z",
"EndDate": "2012-01-22T00:00:00.0000000Z",
"TimeSpan": "61.00:00:00"
},
"ActualActiveRange": {
"StartDate": "2011-11-22T00:00:00.0000000Z",
"EndDate": "2012-01-22T00:00:00.0000000Z",
"TimeSpan": "61.00:00:00"
},
...
}
public class PublishedPolicyIndex :
AbstractMultiMapIndexCreationTask<PublishedPolicyIndex.ReduceResult>
{
public PublishedPolicyIndex() {
AddMap<Publication>(publications => publications.Select(publication => new {
ArtifactId = "artifacts/" + publication.Rendering.ArtifactId,
ActiveStartDate = publication.ActualActiveRange.StartDate,
ActiveEndDate = publication.ActualActiveRange.EndDate,
ViewingPrincipals = (string[]) null,
...
}));
AddMap<Artifact>(artifacts => artifacts.Select(artifact => new {
ArtifactId = artifact.Id,
ActiveStartDate = (string) null,
ActiveEndDate = (string) null,
artifact.ViewingPrincipals,
...
}));
Reduce = results => results.GroupBy(result => result.ArtifactId).Select(g => new {
ArtifactId = g.Key,
ActiveStartDate = g.Select(x => x.ActiveStartDate).SingleOrDefault(x => x != null),
ActiveEndDate = g.Select(x => x.ActiveEndDate).SingleOrDefault(x => x != null),
ViewingPrincipals = g.Select(x => x.ViewingPrincipals).SingleOrDefault(x => x != null),
...
});
Analyzers = new Dictionary<Expression<Func<ReduceResult, object>>, string> {
{rr => rr.ActiveStartDate, "Lucene.Net.Analysis.Standard.StandardAnalyzer"},
{rr => rr.ActiveEndDate, "Lucene.Net.Analysis.Standard.StandardAnalyzer"},
...
};
Stores.Add(x => x.ActiveStartDate, FieldStorage.Yes);
Stores.Add(x => x.ActiveEndDate, FieldStorage.Yes);
}
public class ReduceResult : IReduceResults
{
public string ArtifactId { get; set; }
public string ActiveStartDate { get; set; }
public string ActiveEndDate { get; set; }
public string[] ViewingPrincipals { get; set; }
...
}
}
{
"ArtifactId": "artifacts/533b8cba-8b8f-4c23-b89a-9fff00f5ebd3",
"ActiveStartDate": "20111122000000000",
"ActiveEndDate": "20120322000000000",
"ViewingPrincipals": [
"b0202923-eb07-493d-a0b5-9fff00f5ebd3"
],
...
}