Azure搜索Blob存储不工作



步骤1:我在其中创建了一个通用Blob存储(块Blob)和一个容器(访问策略设置为"容器")。还添加了19个文档(pdf、xlsx、docx、ppt、png、jpg、txt),所有文档都显示在azure门户-->Blob存储容器中。

步骤2:创建Azure搜索(基本层)并遵循本文并执行以下操作。

步骤3:创建数据源

POST https://anysearch.search.windows.net/datasources?api-version=2015-02-28-Preview
Content-Type: application/json
api-key: adminkey
{
    "name" : "blob-datasource",
    "type" : "azureblob",
    "credentials" : { "connectionString" : "DefaultEndpointsProtocol=https;AccountName=mystorage;AccountKey=givenkey==" },
    "container" : { "name" : "containername"}
} 

步骤4:创建一个索引

POST https://anysearch.search.windows.net/indexes?api-version=2015-02-28-Preview
Content-Type: application/json
api-key: adminkey
{
    "name" : "my-target-index",
    "fields": [
        { "name": "id", "type": "Edm.String", "key": true, "searchable": false },
        { "name": "content", "type": "Edm.String", "searchable": true, "filterable": false, "sortable": false, "facetable": false }
    ]
}

步骤5:创建索引器。

POST https://anyearch.search.windows.net/indexers?api-version=2015-02-28-Preview
Content-Type: application/json
api-key: adminkey
{
  "name" : "blob-indexer",
  "dataSourceName" : "blob-datasource",
  "targetIndexName" : "my-target-index",
  "schedule" : { "interval" : "PT5M" }
}

步骤6:运行索引统计并得到以下结果-DOCUMENTCOUNT=0

GET https://anysearch.search.windows.net/indexes/my-target-index/stats?api-version=2015-02-28-Preview
api-key: [admin key]
{
  "@odata.context": "https://mydocsearch.search.windows.net/$metadata#Microsoft.Azure.Search.V2015_02_28_Preview.IndexStatistics",
  "documentCount": 0,
  "storageSize": 1728
}

步骤7:搜索单词"过程",得到以下结果

GET https://anysearch.search.windows.net/indexes/my-target-index/docs?api-version=2015-02-28&search=process
{
    "@odata.context": "https://mydocsearch.search.windows.net/indexes('my-target-index')/$metadata#docs(id,content)",
    "value": []
}

这里出了什么问题?为什么文档计数为0?为什么单词"process"或任何其他搜索词都没有返回任何结果?

请帮忙。

感谢

巴努。

您需要确保索引器成功运行,然后才能搜索文档。您可以在门户中或以编程方式监视索引器状态,这通常会告诉您文档未被索引的原因。在您的情况下,容器包含jpeg和png文件,这些文件不受支持(默认情况下,这种情况会停止索引器的执行)。请查看此处支持的格式列表。

最新更新