topic | languages | products | name | description | azureDeploy | ||
---|---|---|---|---|---|---|---|
sample |
|
|
Get File Extension sample skill for cognitive search |
This custom skill returns the document's extension and file name without extension. |
This custom skill returns the document's file extension and the file name without extension to be indexed accordingly.
These skills have no additional requirements than the ones described in the root README.md
file.
{
"values": [
{
"recordId": "1",
"data":
{
"documentName": "2020_quarterly_earnings.docx",
}
},
{
"recordId": "foo1",
"data":
{
"documentName": "IMPORTANT_COMPANY_ANNOUNCEMENT.eml",
}
}
]
}
{
"values": [
{
"recordId": "1",
"data": {
"extensions" : ".docx",
"fileName" : "2020_quarterly_earnings"
},
"errors": [],
"warnings": []
},
{
"recordId": "foo1",
"data": {
"extensions" : ".eml",
"fileName" : "IMPORTANT_COMPANY_ANNOUNCEMENT"
},
"errors": [],
"warnings": []
}
]
}
In order to use this skill in a cognitive search pipeline, you'll need to add a skill definition to your skillset. Here's a sample skill definition for this example (inputs and outputs should be updated to reflect your particular scenario and skillset environment):
{
"@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
"description": "Our Custom Get File Extension custom skill",
"context": "/document",
"uri": "[AzureFunctionEndpointUrl]/api/get-file-extension?code=[AzureFunctionDefaultHostKey]",
"batchSize": 1,
"inputs": [
{
"name": "documentName",
"source": "/document/metadata_storage_name/"
}
],
"outputs": [
{
"name": "extension",
"targetName": "extension"
},
{
"name": "fileName",
"targetName": "fileName"
}
]
}