Ravendb 在raven索引统计中获得更大的计数结果
我有一个索引,带有一个转换:Ravendb 在raven索引统计中获得更大的计数结果,ravendb,Ravendb,我有一个索引,带有一个转换: docs.FeedPosts .SelectMany(doc => (doc.Labels).DefaultIfEmpty(), (doc, docLabelsItem1) => new {AnnouncementGuid = doc.AnnouncementGuid, CreationDateUtc = doc.CreationWhenAndWhere.Time, FeedOwner = doc.FeedOwner, Key = doc.Key
docs.FeedPosts
.SelectMany(doc => (doc.Labels).DefaultIfEmpty(), (doc, docLabelsItem1) => new {AnnouncementGuid = doc.AnnouncementGuid, CreationDateUtc = doc.CreationWhenAndWhere.Time, FeedOwner = doc.FeedOwner, Key = doc.Key, Labels_Text = doc.Labels
.Select(label => label.Text), SequentialId = ((long)doc.SequentialId), SubjectGuid = doc.SubjectGuid, SubjectId = doc.SubjectId})
(转换)
它用于查询数据。但是如果我要求统计数据,我会得到错误的文档计数!(我将查询限制为0个结果,并请求raven统计信息)
因为我的文档看起来像这样:
{
Labels: [
{ Text: "label 1" }
{ Text: "label 2" }
]
}
Raven为这一个文档生成两个索引项——如果我查看Raven查询工具,第一个索引包含实际的索引数据,第二个索引文档完全是空的
如果一个文档中有3个标签,它将生成3个索引结果。。。我的“计数”是应该的3倍
发生什么事了
谢谢我将您的索引转换为查询语法,因为这样更容易查看:
from doc in docs.FeedPosts
from NOT_USING_THIS in doc.labels
select new
{
AnnouncementGuid = doc.AnnouncementGuid,
CreationDateUtc = doc.CreationWhenAndWhere.Time,
FeedOwner = doc.FeedOwner,
Key = doc.Key,
Labels_Text = doc.Labels.Select(label => label.Text),
SequentialId = ((long)doc.SequentialId),
SubjectGuid = doc.SubjectGuid,
SubjectId = doc.SubjectId}
}
第二个from子句是索引中的SelectMany(),您没有使用它的值
如果将其删除并在根对象上工作,则不会出现此问题
这方面的文件包括:
我将您的索引转换为查询语法,因为这样更容易查看:
from doc in docs.FeedPosts
from NOT_USING_THIS in doc.labels
select new
{
AnnouncementGuid = doc.AnnouncementGuid,
CreationDateUtc = doc.CreationWhenAndWhere.Time,
FeedOwner = doc.FeedOwner,
Key = doc.Key,
Labels_Text = doc.Labels.Select(label => label.Text),
SequentialId = ((long)doc.SequentialId),
SubjectGuid = doc.SubjectGuid,
SubjectId = doc.SubjectId}
}
第二个from子句是索引中的SelectMany(),您没有使用它的值
如果将其删除并在根对象上工作,则不会出现此问题
这方面的文件包括:
啊,太棒了——这就解决了问题。我不知道工会是怎么溜进去的。。。谢谢,太棒了,这就解决了。我不知道工会是怎么溜进去的。。。谢谢