Ein Index, zwei Indexer, populieren ArrayC#

Ein Treffpunkt für C#-Programmierer
Guest
 Ein Index, zwei Indexer, populieren Array

Post by Guest »

Meine Indizes sehen so aus: < /p>

Code: Select all

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; } = [];
}
Der erste Indexer arbeitet ordnungsgemäß und fördert alle Eigenschaften mit Ausnahme von Abonnements aus einer Inhalts -SQL -Datenbank.
Der zweite Indexer ist Nicht zu arbeiten, wie ich es möchte. Unsere Abonnementdaten befinden sich in einer separaten Datenbank und Links über ContentID . Die Abfrage, die ich im Indexer verwende, lautet: < /p>

Code: Select all

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>
Meine FieldMappings in diesem Index sind: < /p>
[new FieldMapping("ContentId") { TargetFieldName = nameof(Content.Id) }]
Ich habe versucht, einen Skillset nach ContentID zu verwenden und alle Abonnementnamen in den Abonnements zu setzen Sammlung (edm.string) .

Code: Select all

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>
Dann füge ich AusgabefieldMappings von: < /p>
hinzu[new FieldMapping("/document/groupedSubscriptionOptionNames") { TargetFieldName = nameof(Content.Subscriptions) }]
Keine der Abonnements wird besiedelt. Was mache ich falsch?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post