My index looks like this:
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<string> Subscriptions { get; set; } = [];
}
The first indexer is properly working and populates all of the properties except Subscriptions from a content SQL database.
The second indexer is not working as I would like it to. Our subscription data is in a separate database and links via ContentId. So, the query I'm using on the indexer is:
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
My FieldMappings on this index is:
[new FieldMapping("ContentId") { TargetFieldName = nameof(Content.Id) }]
I've attempted to use a Skillset to group by the ContentId and put all of the SubscriptionNames in the Subscriptions Collection(Edm.String).
var shaperInputs = new List<InputFieldMappingEntry>
{
new InputFieldMappingEntry("inputs")
{
Source = "/document/SubscriptionName"
},
new InputFieldMappingEntry("groupBy")
{
Source = "/document/ContentId"
}
};
var shaperOutputs = new List<OutputFieldMappingEntry>
{
new OutputFieldMappingEntry("output")
{
TargetName = "groupedSubscriptionNames"
}
};
var skillset = new SearchIndexerSkillset("content-index-subscription-skillset", new List<SearchIndexerSkill>
{
new ShaperSkill(shaperInputs, shaperOutputs)
{
Name = "groupSubscriptionNames",
Description = "Group SubscriptionNames by ContentId",
Context = "/document"
}
});
Then I add OutputFieldMappings of:
[new FieldMapping("/document/groupedSubscriptionOptionNames") { TargetFieldName = nameof(Content.Subscriptions) }]
None of the Subscriptions get populated. What am I doing wrong?