在 API 版本 2016-09-01 中创建自定义分析器时出错
Error when creating Custom Analyzer in API version 2016-09-01
我目前正在使用 Azure 搜索中的自定义分析器。我之前在 Azure 搜索 API“2015-02-28-Preview”的预览版中取得了很大的成功,它引入了该功能。我目前正在尝试将我的自定义分析器迁移到 API 版本“2016-09-01”,根据本文 (https://docs.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 (request access here https://azure.github.io/)
在您的示例中,将 KeywordTokenizer 更改为 KeywordTokenizerV2,对于 StandardTokenizer 和 EdgeNGramTokenFilter 也是如此。
更新:
新版文档上线:https://docs.microsoft.com/en-us/rest/api/searchservice/custom-analyzers-in-azure-search
我目前正在使用 Azure 搜索中的自定义分析器。我之前在 Azure 搜索 API“2015-02-28-Preview”的预览版中取得了很大的成功,它引入了该功能。我目前正在尝试将我的自定义分析器迁移到 API 版本“2016-09-01”,根据本文 (https://docs.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 (request access here https://azure.github.io/)
在您的示例中,将 KeywordTokenizer 更改为 KeywordTokenizerV2,对于 StandardTokenizer 和 EdgeNGramTokenFilter 也是如此。
更新:
新版文档上线:https://docs.microsoft.com/en-us/rest/api/searchservice/custom-analyzers-in-azure-search