Код: Выделить всё
public class Content
{
[SimpleField(IsFilterable = true, IsKey = true)]
public required string Id { get; set; }
[SimpleField(IsFilterable = true, IsSortable = true, IsFacetable = true)]
public required string ContentType { get; set; }
[SearchableField(IsSortable = true, AnalyzerName = LexicalAnalyzerName.Values.StandardLucene)]
public required string Name { get; set; }
[SearchableField(IsSortable = true, AnalyzerName = LexicalAnalyzerName.Values.StandardLucene)]
public string? Description { get; set; }
[SimpleField(IsFilterable = true, IsFacetable = true)]
public ICollection Subscriptions { get; set; } = [];
}
Второй индексер Не работаю, как хотелось бы. Наши данные подписки находятся в отдельной базе данных и ссылках через ContentId . Итак, запрос, который я использую в индексере: < /p>
Код: Выделить всё
SELECT SC.ContentId AS ContentId
,S.SubscriptionName AS SubscriptionName
,SC.ModifyDate AS ModifyDate
FROM dbo.SubscriptionContent SC
INNER JOIN dbo.Subscription S ON S.SubscriptionId = SC.SubscriptionId
< /code>
Мои полевые приложения по этому индексу:
[new FieldMapping("ContentId") { TargetFieldName = nameof(Content.Id) }]Я попытался использовать навыки для группы с помощью ContentId и поместить все подписки s в подписке collection (edm.string) .
Код: Выделить всё
var shaperInputs = new List
{
new InputFieldMappingEntry("inputs")
{
Source = "/document/SubscriptionName"
},
new InputFieldMappingEntry("groupBy")
{
Source = "/document/ContentId"
}
};
var shaperOutputs = new List
{
new OutputFieldMappingEntry("output")
{
TargetName = "groupedSubscriptionNames"
}
};
var skillset = new SearchIndexerSkillset("content-index-subscription-skillset", new List
{
new ShaperSkill(shaperInputs, shaperOutputs)
{
Name = "groupSubscriptionNames",
Description = "Group SubscriptionNames by ContentId",
Context = "/document"
}
});
< /code>
Тогда я добавляю выходные полеты:
[new FieldMapping("/document/groupedSubscriptionOptionNames") { TargetFieldName = nameof(Content.Subscriptions) }]Ни одна из подписок не становится заполненной. Что я делаю не так?
Подробнее здесь: https://stackoverflow.com/questions/794 ... late-array
Мобильная версия