azure - 在 API 版本 2016-09-01 中创建自定义分析器时出错

标签 azure azure-cognitive-search

我目前正在 Azure 搜索中使用自定义分析器。我之前在 Azure 搜索 API 的预览版“2015-02-28-Preview”中取得了很大的成功,该版本引入了该功能。我目前正在尝试将自定义分析器迁移到 API 版本“2016-09-01”,根据本文 (https://learn.microsoft.com/en-us/azure/search/search-api-migration),该版本包括自定义 Anlayzer 支持。我的分析器配置如下:

 "analyzers": [
    {
      "name": "phonetic_area_analyzer",
      "@odata.type": "#Microsoft.Azure.Search.CustomAnalyzer",
      "tokenizer": "area_standard",
      "tokenFilters": [ "lowercase", "asciifolding", "areas_phonetc" ]
    },
    {
      "name": "partial_area_analyzer",
      "@odata.type": "#Microsoft.Azure.Search.CustomAnalyzer",
      "tokenizer": "area_standard",
      "tokenFilters": [ "lowercase", "area_token_edge" ]
    },
    {
      "name": "startsWith_area_analyzer",
      "@odata.type": "#Microsoft.Azure.Search.CustomAnalyzer",
      "tokenizer": "area_keyword",
      "tokenFilters": [ "lowercase", "asciifolding", "area_edge" ]
    }
  ],
  "charFilters": [],
  "tokenizers": [
    {
        "name":"area_standard",
        "@odata.type":"#Microsoft.Azure.Search.StandardTokenizer"
    },
    {
        "name":"area_keyword",
        "@odata.type":"#Microsoft.Azure.Search.KeywordTokenizer"
    }
    ],
  "tokenFilters": [
    {
      "name": "area_edge",
      "@odata.type": "#Microsoft.Azure.Search.EdgeNGramTokenFilter",
      "minGram": 2,
      "maxGram": 50
    },
    {
      "name": "area_token_edge",
      "@odata.type": "#Microsoft.Azure.Search.EdgeNGramTokenFilter",
      "minGram": 2,
      "maxGram": 20
    },
    {
      "name": "areas_phonetc",
      "@odata.type": "#Microsoft.Azure.Search.PhoneticTokenFilter",
      "encoder": "doubleMetaphone"
    }
  ]

此配置在使用版本“2015-02-28-Preview”时有效,但当我尝试版本“2016-09-01”时,我收到以下错误作为响应:

{
  "error": {
    "code": "",
    "message": "The request is invalid. Details: index : The tokenizer of type 'standard' is not supported in the API version '2016-09-01'.\r\n"
  }
}

我的配置是否有问题,或者版本“2016-09-01”仅允许自定义分析器功能的有限子集?如果是这种情况,有人可以向我指出一些详细说明支持哪些功能的文档吗?

最佳答案

抱歉,更新文档的过程出现延迟。这是我的拉取请求,其中包含我们在 2016 年 9 月 1 日引入的更改:https://github.com/Azure/azure-docs-rest-apis/pull/218 (在此处请求访问 https://azure.github.io/ )

在您的示例中,将 KeywordTokenizer 更改为 KeywordTokenizerV2,对于 StandardTokenizer 和 EdgeNGramTokenFilter 也是如此。

更新:

新版本文档上线:https://learn.microsoft.com/en-us/rest/api/searchservice/custom-analyzers-in-azure-search

关于azure - 在 API 版本 2016-09-01 中创建自定义分析器时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40965563/

相关文章:

azure - 在 Azure 搜索中重新索引后分页

Azure 搜索索引器无法检索从 DocumentDB 中的文档归档的 GeographyPoint

sql - 如何在 SQL 中写出/转换 YYYY-MM-DD 为 "Month, DD, YYYY"

Azure 应用服务 - 我是否需要在 docker-compose 中公开端口

Azure Active Directory 撤销给定 aad app-id 的一组用户 session

azure - 将 Azure 计算机视觉读取响应转换为 Azure 认知搜索中相关的 MergeText 技能

azure-cognitive-search - "A version conflict was detected when attempting to index this document."在 Azure 搜索中意味着什么?

azure - 通过 Azure Functions 处理 Azure 事件中心事件与使用 Azure.Messaging.EventHub SDK 的 .NET 控制台应用程序处理 Azure 事件中心事件,有任何实际差异吗?

c# - 如何从 Azure Blob 存储下载视频?

Azure Blob 存储索引器在图像上失败