protected override async Task SetupCollectionAsync(IMongoCollection <MongoTextIndexEntity <Dictionary <string, string> > > collection, CancellationToken ct) { await base.SetupCollectionAsync(collection, ct); index = await AtlasIndexDefinition.CreateIndexAsync(options, Database.DatabaseNamespace.DatabaseName, CollectionName(), ct); }
protected override Dictionary <string, string> BuildTexts(Dictionary <string, string> source) { var texts = new Dictionary <string, string>(); foreach (var(key, value) in source) { var text = value; var languageCode = AtlasIndexDefinition.GetFieldName(key); if (texts.TryGetValue(languageCode, out var existing)) { text = $"{existing} {value}"; } texts[languageCode] = text; } return(texts); }