1

当我使用 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": {
        "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"
        }

请参阅下面的详细信息;

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

4

1 回答 1

2

就我而言,我发现 Azure 搜索服务默认返回 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 文档,请参阅以下链接。

“最大 # 个方面术语;默认为 10”

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

于 2017-12-04T16:32:41.380 回答