Microsoft.Azure.Search(sdk v3.0.3)不能正确返回所有方面

时间:2017-11-28 13:21:44

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

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

然而;当我使用Postman尝试同样的事情时,它会正确返回所有方面。

这可能是sdk的一个错误(我相信这是直接调用sdk方法不能正确返回所有方面 - 但找不到关于这个可能错误的任何记录)?如果是,是否有针对sdk的修复程序?任何帮助表示赞赏。

更新 花了一些时间后,我发现该bug不是.NET SDK Specific。

.NET SDK和REST API似乎都存在此问题,并且它们都没有返回所有方面。你能否告诉我这是否有一个已知的错误,它有什么解决方法?

请参阅以下示例;

必须有2个Coaching facet,但只有1个从Azure Search Service返回。

新的搜索查询(添加了facet专家)

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"
        }

请参阅以下详细信息;

enter image description here

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

对于我的情况,我发现默认情况下,Azure搜索服务返回10个方面。这就是为什么我无法看到我的所有方面。

按照以下方式更新我的搜索查询后,我已修复了我的问题,现在我可以在搜索结果中查看所有方面 - 请参阅更新到此的方面位置; facet = specialisms, count: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文档,请参阅以下链接。

&#34;最多面数条款;默认值为10&#34;

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