Microsoft.Azure.Search (sdk v3.0.3) 没有 return 所有方面都正确

Microsoft.Azure.Search (sdk v3.0.3) don't return all the facets correctly

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

但是;当我使用 Postman 尝试同样的事情时,它 return 正确地显示了所有方面。

这可能是 sdk 的一个错误(我相信这是因为直接调用 sdk 方法并没有 return 所有方面都正确 - 但找不到任何关于这可能的记录漏洞)?如果是,是否有针对 sdk 的修复程序?感谢任何帮助。

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

.NET SDK 和 REST API 似乎都有这个问题,其中 none return 是所有方面。能否请您告诉我这是否存在已知错误以及如何解决?

请看下面的例子;

必须有 2 个指导方面,但只有 1 个 return 来自 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": {
        "specialisms@odata.type": "#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"
        }

详情请见下方;

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

按如下方式更新我的搜索查询后,我解决了我的问题,现在我可以在搜索结果中看到我的所有方面 - 请查看更新到此的方面位;方面=专长,计数: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 文档,请参阅以下link。

"max # of facet terms; default is 10"

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