在包含纯文本文件和搜索的 azure blob 存储上创建 azure 搜索索引

create azure search index on azure blob storage containing plain text files and search

我创建了 Azure 搜索服务并且知道 this. However, this link deals with semi structured data. How can I setup an index on text files programmatically in C# similar to this?我还想知道如何将 Azure 搜索服务与我的 blob 存储相关联,还是自动完成?谢谢。

如果您采用第一个 link 中的方法,则需要将酒店模型更改为如下所示:

public class BlobModel
{
        [JsonProperty("@search.score")]
        public float searchscore { get; set; }

        [JsonProperty("content")]
        public string Content { get; set; }

        [JsonProperty("metadata_storage_content_type")]
        public string MetadataStorageContentType { get; set; }

        [JsonProperty("metadata_storage_size")]
        public int MetadataStorageSize { get; set; }

        [JsonProperty("metadata_storage_last_modified")]
        public DateTime MetadataStorageLastModified { get; set; }

        [JsonProperty("metadata_storage_content_md5")]
        public string MetadataStorageContentMd5 { get; set; }

        [JsonProperty("metadata_storage_name")]
        public string MetadataStorageName { get; set; }

        [JsonProperty("metadata_storage_path")]
        public string MetadataStoragePath { get; set; }

        [JsonProperty("metadata_title")]
        public string MetadataTitle { get; set; }

        [JsonProperty("metadata_content_encoding")]
        public string MetadataContentEncoding { get; set; }
}

请注意,您需要手动填充所有这些属性,除非您使用索引器,它会自动将存储绑定到您的索引(如第二个 link 中所述)。如果您不想使用 REST API,Azure 认知搜索 SDK 上也有可用的方法:

https://docs.microsoft.com/en-us/azure/search/tutorial-multiple-data-sources#create-blob-storage-data-source-and-indexer