【发布时间】:2015-07-10 03:52:31
【问题描述】:
我目前在 Sitecore (Sitecore 8 Update 2) 项目中有以下内容:
var index = ContentSearchManager.GetIndex("sitecore_web_index");
IQueryable<SearchResultItem> queryCalls = index.CreateSearchContext().GetQueryable<SearchResultItem>().Where(item =>
item.TemplateName == callTemplateName &&
item.Path.StartsWith(callStartingPath) &&
item.Language == Sitecore.Context.Language.Name &&
item.Fields["appliedthemes"].ToString().Contains(themeID))
这应该给我某个路径下的所有项目,并以某种语言使用某个模板名称(工作正常)。 最后一行确保只返回带有特定标签的项目。
但是,我似乎无法在最后一条语句中使用 ToString() 方法,因为它无法转换为 SQL。但是我找不到其他的方法来写这个。
编辑:
错误
Server Error in '/' Application.
The method 'ToString' is not supported. Declaring type: System.Object
Description: An unhandled exception occurred.
Exception Details: System.NotSupportedException: The method 'ToString' is not supported. Declaring type: System.Object
【问题讨论】:
-
wt 是你得到的错误吗?
-
item.Fields["appliedThemes"] 返回什么数据类型?
-
Sitecore.Data.Fields.Field
-
试试 item.Fields["appliedthemes"].Value.ToString()
-
您能否明确说明应用的方式
标签: c# sql sitecore iqueryable