首页 > 解决方案 > 如何将不同的自定义技能组映射到索引

问题描述

尝试在技能集中添加自定义技能并将其映射到索引中

这是详细的

我在我的技能集中使用 azure Named Entity Recognition 作为

    {
        "@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 自定义技能 我确实发布了该功能,当我去手动测试它,它按预期工作。但总体而言,它不适用于技能组合。我希望它获取位置并对其进行过滤并仅在搜索索引中它自己的字段中输出不同的值。我很难配置技能组和索引器以使其正常工作。

请问有什么帮助吗?

标签: azureazure-functionsazure-cognitive-searchazure-cognitive-servicesazure-search-.net-sdk

解决方案


您需要像这样添加独特的自定义技能,假设您想要对整个文档进行重复数据删除

{
    "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://docs.microsoft.com/en-us/azure/search/cognitive-search-custom-skill-interface#sumption-custom-skills-from-skillset


推荐阅读