azure - Microsoft.Azure.Search(sdk v3.0.3)未正确返回所有方面

标签 azure faceted-search azure-cognitive-search azure-search-.net-sdk

当我使用 Microsoft.Azure.Search (v3.0.3) 的“SearchAsync”和“Search”方法返回索引项时,sdk 不会返回所有方面。

但是;当我使用 Postman 尝试相同的操作时,它会正确返回所有方面。

这可能是 sdk 的错误吗(我相信这是因为直接调用 sdk 方法无法正确返回所有方面 - 但找不到有关此可能错误的任何记录)?如果是的话,sdk 有解决这个问题的方法吗?如有任何帮助,我们将不胜感激。

更新: 花了更多时间后,我发现该错误不是 .NET SDK 特定的。

.NET SDK 和 REST API 似乎都存在此问题,并且它们都没有返回所有方面。您能告诉我是否存在已知的错误以及修复方法是什么?

请参阅以下示例;

必须有 2 个辅导方面,但只有 1 个从 Azure 搜索服务返回。

新的搜索查询(添加了方面专业)

https://MYPROJECT-search.search.windows.net/indexes/myproject-directory-qa/docs?api-version=2016-09-01&$count=true&facet=specialisms&$filter=listingType eq 'Therapist'
 "Coaching:Development coaching", --> This doesn't return as a facet.
 "Coaching:Executive coaching", -->This returns fine.


  "@search.facets": {
        "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="03707366606a626f6a706e70436c676277622d777a7366" rel="noreferrer noopener nofollow">[email protected]</a>": "#Collection(Microsoft.Azure.Search.V2016_09_01.QueryResultFacet)",
        "specialisms": [
            {
                "count": 5,
                "value": "Anxiety, depression and trauma:Depression"
            },
            {
                "count": 4,
                "value": "Addiction, self-harm and eating disorders:Obsessions"
            },
            {
                "count": 4,
                "value": "Anxiety, depression and trauma:Post-traumatic stress"
            },
            {
                "count": 4,
                "value": "Coaching:Executive coaching"
            },
            {
                "count": 4,
                "value": "Identity, culture and spirituality:Self esteem"
            },
            {
                "count": 4,
                "value": "Relationships, family and children:Pregnancy related issues"
            },
            {
                "count": 4,
                "value": "Stress and work:Redundancy"
            },
            {
                "count": 3,
                "value": "Addiction, self-harm and eating disorders:Eating disorders"
            },
            {
                "count": 3,
                "value": "Anxiety, depression and trauma:Bereavement"
            },
            {
                "count": 3,
                "value": "Anxiety, depression and trauma:Loss"
            }
        ]
    },


{
            "@search.score": 1,
            "contactId": "df394997-6e94-e711-80ed-3863bb34db00",
            "location": {
                "type": "Point",
                "coordinates": [
                    -2.58586,
                    51.47873
                ],
                "crs": {
                    "type": "name",
                    "properties": {
                        "name": "EPSG:4326"
                    }
                }
            },
            "profileImageUrl": "https://myprojectwebqa.blob.core.windows.net/profileimage/3e31457c-5113-4062-b960-30f038ce7bfc.jpg",
            "locationText": "Bristol",
            "listingType": "Therapist",
            "disabledAccess": true,
            "flexibleHours": true,
            "offersConcessionaryRates": false,
            "homeVisits": true,
            "howIWillWork": "<p>Some test data</p>",
            "specialisms": [
                "Health related issues:Asperger syndrome",
                "Health related issues:Chronic fatigue syndrome/ME",
                "Addiction, self-harm and eating disorders:Addictions",
                "Addiction, self-harm and eating disorders:Eating disorders",
                "Addiction, self-harm and eating disorders:Obsessions",
                "Anxiety, depression and trauma:Bereavement",
                "Anxiety, depression and trauma:Depression",
                "Anxiety, depression and trauma:Loss",
                "Coaching:Development coaching",
                "Coaching:Executive coaching",
                "Identity, culture and spirituality:Self esteem",
                "Identity, culture and spirituality:Sexuality",
                "Relationships, family and children:Infertility",
                "Relationships, family and children:Relationships",
                "Stress and work:Redundancy"
            ],
            "clientele": [
                "Adults",
                "Children",
                "Groups"
            ],
            "approaches": [
                "CBT",
                "Cognitive",
                "Psychoanalytic",
                "Psychosynthesis"
            ],
            "sessionTypes": [
                "Home visits",
                "Long-term face to face work"
            ],
            "hourlyRate": 50,
            "fullName": "Test Name",
            "id": "ZWUwNGIyNjYtYjQ5Ny1lNzExLTgwZTktMzg2M2JiMzY0MGI4"
        }

请参阅下面的详细信息;

enter image description here

enter image description here

enter image description here

最佳答案

就我而言,我发现默认情况下 Azure 搜索服务返回 10 个方面。这就是为什么我看不到自己的所有方面。

按如下方式更新我的搜索查询后,我已经解决了我的问题,现在我可以在搜索结果中看到我的所有方面 - 请参阅更新为此的方面位; facet=specialisms,计数:9999

 https://MYPROJECTNAME-search.search.windows.net/indexes/MYPROJECTNAME-directory-qa/docs?api-version=2016-09-01&$count=true&facet=specialisms, count:9999&facet=clientele, count:9999&$filter=listingType eq 'Therapist'

有关 Microsoft 文档,请参阅以下链接。

“最大方面术语数;默认值为 10”

https://learn.microsoft.com/en-us/rest/api/searchservice/search-documents

关于azure - Microsoft.Azure.Search(sdk v3.0.3)未正确返回所有方面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47532656/

相关文章:

没有 web.config 的 Azure 和 .json mimeType

node.js - 尝试在 Azure 上使用 imagemagick 出现 "system cannot find the file"错误

azure - 在 Azure 移动服务中使用身份验证提供程序时出现问题

python - 干草堆刻面 : __init__() got an unexpected keyword argument 'facet_fields'

azure - 此 Azure 搜索索引错误意味着什么? "The property ' x' 在类型 'search.documentFields' 上不存在 ...”

Powershell:导出 csv 文件中的 System.Object[]

range - elasticsearch 范围方面的 count 和 total_count 有什么区别?

lucene - .NET 站点上的 Solr

azure - 获取 Azure 搜索中的实际匹配数

c# - 如何设置附加到 Azure 存储的 Azure 搜索软删除策略