索引中的地图sitecore 8常规链接字段 [英] Map sitecore 8 general link field from Index
问题描述
我正在使用sitecore内容搜索API从sitecore索引获取常规链接字段.下面是我的模型
I am using sitecore content search API to get the general link field from sitecore index. Below is my model
public class GrantItem : BaseSearchItem
{
[IndexField("grant_name")]
public string GrantName { get; set; }
[IndexField("grant_description")]
public string GrantDescription { get; set; }
[IndexField("grant_categories_sm")]
public CategoryItem[] GrantCategories { get; set; }
[IndexField("grant_status_s")]
public CategoryItem GrantStatus { get; set; }
[IndexField("grant_application_type_sm")]
[TypeConverter(typeof(IndexFieldIDValueConverter))]
public IEnumerable<ID> ApplicationType { get; set; }
[IndexField("grant_url")]
public string GrantURL { get; set; }
}
当我使用Sitecore内容搜索API时.我在GrantURL中获得以下xml.
When I am using sitecore content search API. I am getting the following xml in the GrantURL.
<link linktype=\"external\" url=\"http://www.google.com.au\" anchor=\"\"
target=\"\" />
sitecore中是否有任何默认转换器将其映射到链接"字段,还是我需要手动对其进行解析或创建自定义转换器?
Is there any default converter in sitecore to map this to a Link field or do I need to parse it manually or create a custom converter ?
推荐答案
据我所知,没有用于此的类型转换器.
As far as I am aware there no type converters for this.
尽管很容易创建自己的.这篇博客文章包含对我有用的代码,您只需要实现ConvertFrom和ConvertTo方法
It's quite easy to create your own though. This blog post has code that worked for me and you just have to implement the ConvertFrom and ConvertTo methods
http://reasoncodeexample.com/2014/01/30/indexing-datetime-fields-sitecore-7-content-search/
这篇关于索引中的地图sitecore 8常规链接字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!