Sitecore IndexField:生成的IEnumerable为空

时间:2015-04-08 15:32:19

标签: indexing sitecore glass-mapper

我的模型中有以下字段:

public virtual IEnumerable<Person> Authors { get; set; }
public virtual IEnumerable<ExternalContributor> External_Contributors { get; set; }

[IndexField("Authors")]
[TypeConverter(typeof(IndexFieldGuidValueConverter))]
public virtual IEnumerable<Guid> AuthorIds { get; set; }

[IndexField("External Contributors")]
[TypeConverter(typeof(IndexFieldGuidValueConverter))]
public virtual IEnumerable<Guid> ExternalContributorIds { get; set; }

我在字段中有一个GuiD的MultiList&#34; Authors&#34;和&#34;外部贡献者&#34;。当我尝试访问这些字段时,&#34;作者&#34;填充了对象列表,而External_Contributors始终为空。

这里有什么显而易见的东西吗?


编辑: 以下是Person和ExternalContributor的定义:

[SitecoreType(TemplateId = "{2CD821FC-A334-49F4-93B9-CB0D8E7D71FF}", AutoMap = true)]
    public class Person : ImageTemplate, ITagged, IViewImage, IViewCover, ISectors, ISpecialisms, IEquatable<Person>
    {
        public static string ParentPath = "/sitecore/content/Data/People";
        public static Guid Template = new Guid("{2CD821FC-A334-49F4-93B9-CB0D8E7D71FF}");

        [...various fields...]
    }
}

[SitecoreType(TemplateId = "{7C35993C-140B-43FE-A00A-7ADA00A2A488}", AutoMap = true)]
    public class ExternalContributor : ImageTemplate, ITagged, IViewImage, IEquatable<ExternalContributor>
    {
        public static string ParentPath = "/sitecore/content/Blue Rubicon Data/external-contributors";
        public static Guid Template = new Guid("{7C35993C-140B-43FE-A00A-7ADA00A2A488}");

        [...various fields...]
    }
}

1 个答案:

答案 0 :(得分:2)

这样的事情怎么样: [IndexField( “External_Contributors”)]

我不确定,但我从未见过带空格的索引字段,我不知道字段名翻译器(如果它仍然存在)是否会修复它。

在应用更改后,您应该重新索引您的项目。