尝试对 RavenDB 运行特定查询时出现以下错误:
Can't extract value from expression of type: ArrayIndex
这是生成错误的查询:
people = from p in RavenSession.Query<DBObjects.Person, People_ByNameAndTrashedSortByFirstNameAndLastName>()
orderby p.FirstName, p.LastName
select p;
...
//building LINQ query
...
people = from p in people
where ((p.FirstName.StartsWith(SearchWords[0])) && (p.LastName.StartsWith(SearchWords[1])))
select p;
...
//later
foreach(DBObject.Person person in people) //triggers error listed above
{
}
我想知道这是否是 RavenDB 的限制。我注意到,如果我&&
用切换||
,那么我不会收到错误。当然,我也没有得到我想要的结果。我也尝试将查询重写为:
people = from p in people
where p.FirstName.StartsWith(SearchWords[0])
where p.LastName.StartsWith(SearchWords[1])
select p;
我犯了同样的错误。
我也尝试过使用动态索引而不是静态索引。我犯了同样的错误。