首页 > 解决方案 > 在 Azure 认知搜索中应用 EdgeNGram 自定义分析器时,文档亮点为空/空

问题描述

我们正在使用 Azure 认知搜索为客户构建文档搜索引擎。我们正在尝试在“内容”字段(文件的内容,base64 编码)上应用自定义分析器。

这是分析器的定义:

    "analyzers": [
    {
        "@odata.type": "#Microsoft.Azure.Search.CustomAnalyzer",
        "name": "pri_standard", 
        "tokenizer": "standard_v2",
        "tokenFilters": [
            "lowercase",
            "asciifolding",
            "phonetic"
        ],
        "charFilters": []
    },
    {
        "@odata.type": "#Microsoft.Azure.Search.CustomAnalyzer",
        "name": "pri_custom_analyzer",
        "tokenizer": "EdgeNGram",
        "tokenFilters": [
            "lowercase",
            "pri_edgeNGram"
        ],
        "charFilters": []
    }
],

以下是它在索引字段中的应用方式

  "fields": [
    {
        "name": "content",
        "type": "Edm.String",
        "searchable": true,
        "filterable": false,
        "retrievable": true,
        "sortable": false,
        "facetable": false,
        "key": false,
        "indexAnalyzer": null,
        "searchAnalyzer": null,
        "analyzer": "pri_custom_analyzer",
        "synonymMaps": [
            "industry-synonyms2"
        ]
    },

令牌过滤器定义

  "tokenFilters": [
        {
            "@odata.type": "#Microsoft.Azure.Search.EdgeNGramTokenFilterV2",
            "name": "pri_edgeNGram",
            "maxGram": 15,
            "side": "front"
        }
    ],

当我们搜索索引时,Document Highlights 字段始终为空。当我们应用标准分析器时,它可以正常工作,即我们得到正确返回的文档亮点。我们在这里做错了什么?

标签: azurenlpsearch-engineazure-cognitive-search

解决方案


推荐阅读