简体   繁体   中英

Azure Congnitive Service Skill not persisting custom skill value

I have create a custom skill for my Azure Cognitive Service. After creating the datasouce, index, indexer and running the indexer I can see that my function is being called and it is outputting the correct information, but when I search the index the field that is connected to the custom skill is empty.

This is my indexer definition:

{
  "name": "idxdocs",
  "description": null,
  "dataSourceName": "dsdocs",
  "skillsetName": "skillset-procuradores",
  "targetIndexName": "customer-documents",
  "disabled": null,
  "schedule": null,
  "parameters": {
    "batchSize": null,
    "maxFailedItems": -1,
    "maxFailedItemsPerBatch": null,
    "base64EncodeKeys": null,
    "configuration": {
      "indexedFileNameExtensions": ".pdf,.docx,.doc",
      "dataToExtract": "contentAndMetadata",
      "failOnUnprocessableDocument": false,
      "failOnUnsupportedContentType": false,
      "indexStorageMetadataOnlyForOversizedDocuments": true,
      "allowSkillsetToReadFileData": true
    }
  },
  "fieldMappings": [],
  "outputFieldMappings": [
    {
      "sourceFieldName": "/document/content/procuradores",
      "targetFieldName": "procuradores"
    }
  ],
  "cache": null,
  "encryptionKey": null
}

This is my index:

{
  "name": "customer-documents",
  "fields": [
    {
      "name": "key",
      "type": "Edm.String",
      "facetable": true,
      "filterable": true,
      "key": true,
      "retrievable": true,
      "searchable": false,
      "sortable": true,
      "analyzer": null,
      "indexAnalyzer": null,
      "searchAnalyzer": null,
      "synonymMaps": [],
      "fields": []
    },
    {
      "name": "content",
      "type": "Edm.String",
      "facetable": false,
      "filterable": false,
      "key": false,
      "retrievable": true,
      "searchable": true,
      "sortable": false,
      "analyzer": "es.lucene",
      "indexAnalyzer": null,
      "searchAnalyzer": null,
      "synonymMaps": [],
      "fields": []
    },
    {
      "name": "procuradores",
      "type": "Edm.String",
      "facetable": false,
      "filterable": true,
      "key": false,
      "retrievable": true,
      "searchable": false,
      "sortable": false,
      "analyzer": null,
      "indexAnalyzer": null,
      "searchAnalyzer": null,
      "synonymMaps": [],
      "fields": []
    }
  ],
  "suggesters": [],
  "scoringProfiles": [],
  "defaultScoringProfile": null,
  "corsOptions": null,
  "analyzers": [],
  "charFilters": [],
  "tokenFilters": [],
  "tokenizers": [],
  "similarity": {
    "@odata.type": "#Microsoft.Azure.Search.BM25Similarity",
    "k1": null,
    "b": null
  },
  "encryptionKey": null,
  "@odata.etag": "\"0x8D98BC85E9F6996\""
}

My skill set definition:

{
  "name": "skillset-procuradores",
  "description": "",
  "skills": [
    {
      "@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
      "name": "procuradores",
      "description": "",
      "context": "/document",
      "uri": "my url ommited for secure reasons",
      "httpMethod": "POST",
      "timeout": "PT3M50S",
      "batchSize": 1,
      "degreeOfParallelism": null,
      "inputs": [
        {
          "name": "text",
          "source": "/document/content"
        }
      ],
      "outputs": [
        {
          "name": "procuradores",
          "targetName": "procuradores"
        }
      ],
      "httpHeaders": {}
    }
  ],
  "cognitiveServices": null,
  "knowledgeStore": null,
  "encryptionKey": null
} 

And finally my function output:

{
    "values": [
        {
            "recordId": "1",
            "data": {
                "procuradores": "people's names"
            }
        }
    ]
}

What am I missing?

Rafael, can you give debug sessions a try? I suspect there is something happening in your custom skill that means the data is not coming back. By using this, you can test the actual input and output.

https://learn.microsoft.com/en-us/azure/search/cognitive-search-debug-session

This is just a hunch, but in the indexer definition, try changing your output field mapping sourceFieldName from "/document/content/procuradores" to "/document/procuradores". The context that you are giving in the skill is just "/document" so it should append the output onto that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM