Sitecore IndexField:结果 IEnumerable 为空

Sitecore IndexField: resulting IEnumerable is empty

我的模型中有以下字段:

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; }

并且我在字段 "Authors" 和 "External Contributors" 中有一个 GuiD 的多列表。当我尝试访问这些字段时,"Authors" 填充了一个对象列表,而 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...]
    }
}

像这样的事情怎么样: [索引字段("External_Contributors")]

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

您应该在应用更改后重新索引您的项目,然后它才能起作用。