Share via

Bug: https://graph.microsoft.com/v1.0/search/query total is wrong when results include an externalItem

catmanjan 116 Reputation points
2025-03-24T00:26:53.66+00:00

Here is the request:

{
    "requests": [
        {
            "contentSources": [
                "/external/connections/*"
            ],
            "entityTypes": [
                "driveItem",
                "externalItem"
            ],
            "query": {
                "queryString": "presentation for client xyz"
            }
        }
    ]
}


And here is the response:

{
    "value": [
        {
            "searchTerms": [
                "presentation",
                "for",
                "client",
                "xyz"
            ],
            "hitsContainers": [
                {
                    "hits": [
                        {
                            "hitId": "01QV4VBAJX2CKHR67ZM5HZNKI2IFJPMML7",
                            "rank": 1,
                            "summary": "<c0>Client</c0> <c0>XYZ</c0> <c0>presentation</c0> <ddd/>",
                            "resource": {
                                "@odata.type": "#microsoft.graph.driveItem",
                                "size": 34290,
                                "fileSystemInfo": {
                                    "createdDateTime": "2025-03-04T23:28:36Z",
                                    "lastModifiedDateTime": "2025-03-04T23:31:22Z"
                                },
                                "listItem": {
                                    "@odata.type": "#microsoft.graph.listItem",
                                    "id": "7894d037-f9fb-4f67-96a9-1a4152f6317f",
                                    "fields": {}
                                },
                                "id": "01QV4VBAJX2CKHR67ZM5HZNKI2IFJPMML7",
                                "createdBy": {
                                    "user": {
                                        "displayName": "Anne Admin",
                                        "email": "testie1@icognition.cloud"
                                    }
                                },
                                "createdDateTime": "2025-03-04T23:28:36Z",
                                "lastModifiedBy": {
                                    "user": {
                                        "displayName": "Anne Admin",
                                        "email": "testie1@icognition.cloud"
                                    }
                                },
                                "lastModifiedDateTime": "2025-03-04T23:31:22Z",
                                "name": "Presentation for Client XYZ.pptx",
                                "parentReference": {
                                    "driveId": "b!rnBEoiPOhUyyI7zWpbyag3Qj2FA-LzVJhxb5VG0bjuh5Q7qKO0dqTpssSrUI12kI",
                                    "id": "01QV4VBAI7ZAQFJXXLRRHKFZ254N4RRFDW",
                                    "sharepointIds": {
                                        "listId": "8aba4379-473b-4e6a-9b2c-4ab508d76908",
                                        "listItemId": "731",
                                        "listItemUniqueId": "7894d037-f9fb-4f67-96a9-1a4152f6317f"
                                    },
                                    "siteId": "icognitiondev-my.sharepoint.com,a24470ae-ce23-4c85-b223-bcd6a5bc9a83,50d82374-2f3e-4935-8716-f9546d1b8ee8"
                                },
                                "webUrl": "https://icognitiondev-my.sharepoint.com/personal/testie1_icognition_cloud/Documents/Documents/Presentation for Client XYZ.pptx"
                            }
                        },
                        {
                            "hitId": "AAMkADEyZDllNzMwLTZhZTMtNDJjOS05NmFhLTdjZTc0MmYzZDFmZgBGAAAAAADWxfqTGgpNRZJBXtGUG2GbBwC6cv7KLgDnRaf+WzeLuQfdAAAAAA+GAADUMdZotsbGQp5rot0jLzWvAAACy4P0AAA=",
                            "contentSource": "IngressCMRecords",
                            "rank": 2,
                            "summary": "PDF Reference sixth edition Adobe® Portable Document Format Version 1.7 November 2006 Adobe Systems Incorporated © 1985–2006 Adobe® Systems Incorporated. All rights reserved. PDF<ddd/>",
                            "resource": {
                                "@odata.type": "#microsoft.graph.externalItem",
                                "properties": {
                                    "iconUrl": "https://hydrakubernetes.icognition.cloud/icon/PDF",
                                    "recordNumber": "X24/20",
                                    "title": "sample",
                                    "lastModifiedDateTime": "2024-09-26T17:25:55Z",
                                    "substrateContentDomainId": "fc709baefa8847bf813519eee9ad4c29@2371829a-0c4d-422b-870f-b47456bf4d0c,trim--10__rec__100405",
                                    "substrateLocationId": "SMTP:******@icognitiondev.onmicrosoft.com",
                                    "fileID": "fc709baefa8847bf813519eee9ad4c29@2371829a-0c4d-422b-870f-b47456bf4d0c,trim--10__rec__100405",
                                    "documentId": 105123,
                                    "immutableEntryId": "AAAAAB2EAxGqZhHNm8gAqgAvxFoNANQx1mi2xsZCnmui3SMvNa8AAALM4TkAAA==",
                                    "id": "AAMkADEyZDllNzMwLTZhZTMtNDJjOS05NmFhLTdjZTc0MmYzZDFmZgBGAAAAAADWxfqTGgpNRZJBXtGUG2GbBwC6cv7KLgDnRaf+WzeLuQfdAAAAAA+GAADUMdZotsbGQp5rot0jLzWvAAACy4P0AAA=",
                                    "url": "https://cm244-wgs-1.icognition.cloud/ContentManager?q=uri:100405&LaunchPreview=100405",
                                    "classification": ""
                                }
                            }
                        }
                    ],
                    "total": 1,
                    "moreResultsAvailable": false,
                    "aggregations": []
                }
            ]
        }
    ],
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.searchResponse)"
}

Notice how "total" is equal to 1 but its returned two results, one is external which I suspect is causing the issue

Microsoft Security | Microsoft Graph
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.