2016-07-28 187 views
0

步驟1:我在其中創建了一個通用Blob存儲(塊blob)和一個容器(訪問策略設置爲「容器」)。還添加了19個文檔(pdf,xlsx,docx,ppt,png,jpg,txt),並且所有文檔都顯示在azure門戶 - > Blob存儲容器中。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?爲什麼「過程」或其他搜索詞沒有返回任何結果?

請幫忙。

謝謝

Bhanu。

回答

1

您需要確保索引器成功運行,然後才能搜索文檔。您可以監視門戶中的索引器狀態或以編程方式監視索引器狀態,這通常會告訴您爲什麼文檔未被編入索引。在你的情況,容器有JPEG和PNG文件,這是不支持的(默認情況下,這種情況停止索引執行)。請查看支持的格式列表here

+0

這就像一個魅力工作!非常感謝。我認爲索引器會忽略不支持的文件。感謝您指出。我從blob中刪除了jpeg和png文件,然後再次運行索引器。有效。 – Bhanu

+0

非常感謝。如果您希望索引器針對不支持的格式自動跳過文本提取(但仍提取一些存儲元數據),請爲此[UserVoice建議]投票(https://feedback.azure.com/forums/263029-azure-search/建議/ 15094944二進制大對象,索引,應該-繼續索引的文檔-AF) –