【发布时间】:2013-11-27 14:01:24
【问题描述】:
我有以下索引定义
public SearchIndex()
{
this.Map = users => from user in users
select new
{
FirstName = user.FirstName,
LastName = user.LastName,
MobilePhoneNumber = user.MobilePhoneNumber,
EmailAddress = user.EmailAddress
};
Index(x => x.FirstName, FieldIndexing.Analyzed);
Index(x => x.LastName, FieldIndexing.Analyzed);
Index(x => x.MobilePhoneNumber, FieldIndexing.Analyzed);
Index(x => x.EmailAddress, FieldIndexing.Analyzed);
}
我尝试像这样使用全文搜索
var s = GetSession().Query<Registrants, StudentSearchIndex>()
.Search(m => m.LastName, lastName, boost: 10, escapeQueryOptions:EscapeQueryOptions.EscapeAll)
.Search(m => m.FirstName, firstName, boost: 5)
.Search(m => m.MobilePhoneNumber, phoneNumber)
.Search(m => m.EmailAddress, emailAddress);
但是,当我在代码中使用上述表达式时。我收到以下错误消息
“System.Object”类型的表达式不能用于“Raven.Client.Linq.IRavenQueryable1[Spurro.Data.RavenDB.Models.Registrants] Search[Registrants](System.Linq.IQueryable1[Spurro.Data.RavenDB.Models.Registrants], System 方法的“System.String”类型参数.Linq.Expressions.Expression1[System.Func2[Spurro.Data.RavenDB.Models.Registrants,System.Object]], System.String, System.Decimal, Raven.Client.SearchOptions, Raven.Client.EscapeQueryOptions)'
请问我做错了什么
【问题讨论】:
标签: c# asp.net asp.net-mvc-4 ravendb