尝试在技能集中添加自定义技能并将其映射到索引中
这是的详细信息
我在我的技能集中使用azure命名实体识别作为
{
"@odata.type": "#Microsoft.Skills.Text.MergeSkill",
"description": "Merge text content with image tags",
"insertPreTag": " ",
"context": "/document",
"inputs": [
{
"name": "text",
"source": "/document/fullTextAndCaptions"
},
{
"name": "itemsToInsert",
"source": "/document/normalized_images/*/Tags/*/name"
}
],
"outputs": [
{
"name": "mergedText",
"targetName": "finalText"
}
]
}
并且在索引器中作为
{
"sourceFieldName": "/document/finalText/pages/*/entities/*/value",
"targetFieldName": "entities"
},
{
"sourceFieldName": "/document/finalText/pages/*/locations/*",
"targetFieldName": "locations"
},
它100%有效,现在我想添加来自https://github.com/Azure-Samples/azure-search-power-skills/tree/master/Text/Distinct我确实发布了这个函数,当我手动测试它时,它可以正常工作。但总的来说,它在技能方面并不奏效。我希望它获取位置并对其进行过滤,并仅在搜索索引中它自己的字段中输出distinct。我真的很难配置技能集和索引器来让它发挥作用。
请帮忙吗?
假设您想对整个文档进行重复数据消除,则需要添加类似这样独特的自定义技能
{
"skills": [
...
{
"@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
"description": "Distinct skill",
"uri": "<https://distinct-skill>",
"context": "/document",
"inputs": [
{
"name": "locations",
"source": /document/finalText/pages/*/locations/*"
}
],
"outputs": [
{
"name": "distinct",
"targetName": "distinctLocations"
}
]
}
...
]
}
以及将其放入索引的输出字段映射。
{
"sourceFieldName": "/document/distinctLocations",
"targetFieldName": "distinctLocations"
}
请参阅https://learn.microsoft.com/en-us/azure/search/cognitive-search-custom-skill-interface#consuming-用于添加自定义技能的技能集中的自定义技能。