Reputation: 11
I want to provide Full Text Search capabilities in my application and so i am trying to configure Azure Search with Cognitive Search capabilities, so that i can index image as well as non-image documents stored in Azure Blob Storage. However, while configuring Azure Search through Java code using Azure Search's REST APIs, i am not able to leverage OCR capabilities into Azure Search and the image documents are not getting indexed. I am missing some configuration details while configuring Azure search through Java code(using Azure Search REST APIs).
Case 1: From Azure Portal, i am able
Case 2: From Java code by using Azure REST APIs, i am able
I am using following sample Azure Search Rest API's from Java code 1. https://%s.search.windows.net/datasources?api-version=%s 2. https://%s.search.windows.net/skillsets/cog-search-demo-ss?api-version=%s 3. https://%s.search.windows.net/indexes/%s?api-version=%s 4. https://%s.search.windows.net/indexers?api-version=%s
Configuration jsons: 1. datasource.json
{
"name" : "csstoragetest",
"type" : "azureblob",
"credentials" : { "connectionString" : "connectionString" },
"container" : { "name" : "csblob" }
}
{
"description": "Extract text from images and merge with content text to produce merged_text",
"skills":
[
{
"description": "Extract text (plain and structured) from image.",
"@odata.type": "#Microsoft.Skills.Vision.OcrSkill",
"context": "/document/normalized_images/*",
"defaultLanguageCode": "null",
"detectOrientation": true,
"inputs": [
{
"name": "image",
"source": "/document/normalized_images/*"
}
],
"outputs": [
{
"name": "text",
"targetName": "myText"
},
{
"name": "layoutText",
"targetName": "myLayoutText"
}
]
},
{
"@odata.type": "#Microsoft.Skills.Text.MergeSkill",
"description": "Create merged_text, which includes all the textual representation of each image inserted at the right location in the content field.",
"context": "/document",
"insertPreTag": " ",
"insertPostTag": " ",
"inputs": [
{
"name":"text", "source": "/document/content"
},
{
"name": "itemsToInsert", "source": "/document/normalized_images/*/text"
},
{
"name":"offsets", "source": "/document/normalized_images/*/contentOffset"
}
],
"outputs": [
{
"name": "mergedText", "targetName" : "merged_text"
}
]
}
]
}
{
"name": "azureblob-indexing",
"fields": [
{ "name": "id", "type": "Edm.String", "key": true, "searchable": false },
{ "name": "content", "type": "Edm.String", "searchable": true, "filterable": false, "sortable": false, "facetable": false }
]
}
{
"name" : "azureblob-indexing1",
"dataSourceName" : "csstoragetest",
"targetIndexName" : "azureblob-indexing",
"schedule" : { "interval" : "PT2H" },
"skillsetName" : "cog-search-demo-ss",
"parameters":
{
"maxFailedItems":-1,
"maxFailedItemsPerBatch":-1,
"configuration":
{
"dataToExtract": "contentAndMetadata",
"imageAction":"generateNormalizedImages",
"parsingMode": "default",
"firstLineContainsHeaders": false,
"delimitedTextDelimiter": ","
}
}
}
After configuring Azure search through java code, the Image documents should get indexed in azure search and i should be able to search them base on the text contained in them.
Upvotes: 0
Views: 471
Reputation: 11
I have figured out the configurations needed by myself. It required matching all the parameters between case 1 & 2 as stated above(in the question) and then updating the configuration jsons.
Upvotes: 0
Reputation: 187
Try setting the default language code to null without the quotes in skillset.json:
"defaultLanguageCode": null
Upvotes: 0