我不确定问题是什么,但我必须做错事,因为索引为空,即使我删除了where b.Status == ...
行。
有什么想法吗?
public class Bookings_ToBeScheduled : AbstractIndexCreationTask<Inspection, BookingRequest>
{
public Bookings_ToBeScheduled()
{
Map = inspections =>
from i in inspections
from b in i.Bookings.Values
where b.Status == BookingStatus.Requested || b.Status == BookingStatus.InspectorAssigned
select new
{
InspectionId = i.Id,
i.InspectionType,
b.BookingNumber
};
}
}
答案 0 :(得分:0)
试试这个,而不是:
public class Bookings_ToBeScheduled : AbstractIndexCreationTask<Inspection, BookingRequest>
{
public Bookings_ToBeScheduled()
{
Map = inspections =>
from i in inspections
select new
{
InspectionId = i.Id,
i.InspectionType,
/*
BookingNumber = i.Bookings.Values
.Where(b => b.Status == BookingStatus.Requested || b.Status == BookingStatus.InspectorAssigned)
.Selcet(b=> b.BookingNumber)
*/
BookingNumber = from b in i.Bookings.Values
where b.Status == BookingStatus.Requested || b.Status == BookingStatus.InspectorAssigned
select b.BookingNumber
};
}
}
通常最好不要在索引中拥有扇出(每个文档有多个条目)。 我不确定哪个版本的BookingNumber会起作用,Linq方法肯定会有用。