[英]Decrypting and Decompressing Data from Azure Blob Storage using C#
[英]How to create an Azure Search Indexer using .net SDK (c#) to pull data from Azure blob storage
public Indexer (string name, string dataSourceName, string targetIndexName, string description = null, string skillsetName = null, Microsoft.Azure.Search.Models.IndexingSchedule schedule = null, Microsoft.Azure.Search.Models.IndexingParameters parameters = null, System.Collections.Generic.IList<Microsoft.Azure.Search.Models.FieldMapping> fieldMappings = null, System.Collections.Generic.IList<Microsoft.Azure.Search.Models.FieldMapping> outputFieldMappings = null, Nullable<bool> isDisabled = null, string eTag = null);
谁能告诉我如何在方法中指定fieldMappings
参数? 还是给我其他代码示例,以使用给定的数据源和索引创建索引器?
我创建了索引和数据源,但是在Azure搜索中为创建Blob存储数据而苦苦挣扎。 我希望使用c#.NET SDK创建索引器。
此样本有帮助吗? 它正在为SQL数据库建立索引,实际上并未显示FieldMapping的示例,但希望它将有助于显示您需要的部分。
您可以如下创建字段映射:
//this creates a field mapping for they key assigned to the blob in blob storage
var keyMapping = new FieldMapping("metadata_storage_name", "key", new FieldMappingFunction { Name = "base64Encode", Parameters = null });
var mappings = new List<FieldMapping>();
mappings.Add(keyMapping);
我还编写了以下函数来创建可能对修改有用的Blob索引器:
private static void CreateBlobIndexer(SearchServiceClient serviceClient
, string IndexerName
, string Description
, string SourceName
, string IndexName
, IndexingSchedule Schedule
, List<FieldMapping> Mappings)
{
var indexingParams = new IndexingParameters();
indexingParams.MaxFailedItems = Convert.ToInt32(ConfigurationManager.AppSettings["MaxFailures"]);
indexingParams.MaxFailedItemsPerBatch = Convert.ToInt32(ConfigurationManager.AppSettings["MaxFailures"]);
indexingParams.DoNotFailOnUnsupportedContentType();
indexingParams.IndexFileNameExtensions(new string[] { ".pdf" });
var definition = new Indexer()
{
Name = IndexerName,
Description = Description,
DataSourceName = SourceName,
TargetIndexName = IndexName,
Schedule = Schedule,
FieldMappings = Mappings,
Parameters = indexingParams
};
serviceClient.Indexers.Create(definition);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.