Azure 认知搜索和空白分析器

时间:2021-07-08 16:07:07

标签: azure azure-cognitive-search azure-cognitive-services

我一直在尝试配置认知搜索索引字段以使用内置的 'whitespace' 分析器,但没有成功。

我最初是通过 Azure 门户创建索引的,后来意识到我不想使用 standard.lucene 分析器,因为我们希望允许使用特殊字符。所以我删除了它并尝试在门户中重新创建它,但下拉列表中没有“空白”分析器的选项。

因此,通过 Postman,我尝试通过将 indexAnalyzer 设置为“空白”并收到 201 Created 指示成功来重新创建它。我检查了门户中的文件,它们就在那里。我还可以通过以下方式成功获取文档列表:

https://[my-service-name].search.windows.net/indexes/[my-index-name]/docs?search=*&$count=true&api-version=2020-06-30< /p>

但是当我搜索一些超级简单的东西(一个没有特殊字符的词)时,我总是找不到记录。与此相关的文档非常稀少(或者我没有找到),并且 github 示例没有解决此分析器。

https://github.com/Azure-Samples/azure-search-postman-samples

我们使用的是 javascript 客户端 @azure/search-documents,所以我也尝试在 Postman 中使用相同的请求。

enter image description here

有谁知道如何用这个分析器配置和查询索引?

过去的定义是:

 {
            "name": "Name",
            "type": "Edm.String",
            "searchable": true,
            "filterable": true,
            "retrievable": true,
            "sortable": true,
            "facetable": true,
            "key": false,
            "indexAnalyzer": null,
            "searchAnalyzer": null,
            "analyzer": "standard.lucene",
            "synonymMaps": []
        }

我试过了:

 {
            "name": "Name",
            "type": "Edm.String",
            "searchable": true,
            "filterable": true,
            "retrievable": true,
            "sortable": true,
            "facetable": true,
            "key": false,
            "indexAnalyzer": "whitespace",
            "searchAnalyzer": "whitespace",
            "analyzer": null,
            "synonymMaps": []
        }

 {
            "name": "Name",
            "type": "Edm.String",
            "searchable": true,
            "filterable": true,
            "retrievable": true,
            "sortable": true,
            "facetable": true,
            "key": false,
            "indexAnalyzer": "whitespace",
            "searchAnalyzer": "standard",
            "analyzer": null,
            "synonymMaps": []
        }

 {
            "name": "Name",
            "type": "Edm.String",
            "searchable": true,
            "filterable": true,
            "retrievable": true,
            "sortable": true,
            "facetable": true,
            "key": false,
            "indexAnalyzer": "whitespace",
            "searchAnalyzer": "simple",
            "analyzer": null,
            "synonymMaps": []
        }

0 个答案:

没有答案