SharePoint Search REST API - PrimaryQueryResult is null

Copper Contributor

I develop a SPFX WebPart that uses the SharePoint Search REST API. This SPFX WP is used in several tenants.

 

The request is this below:

 

{
    "request": {
        "__metadata": {
            "type": "Microsoft.Office.Server.Search.REST.SearchRequest"
        },
        "Querytext": "ContentClass:STS_Site AND WebTemplate:GROUP (NOT PrivacyIndicator:4) Title:test* ",
        "RowLimit": 20,
        "TrimDuplicates": false,
        "SortList": {
            "results": [
                {
                    "Direction": 1,
                    "Property": "LastModifiedTime"
                }
            ]
        },
        "SelectProperties": {
            "results": [
                "LastModifiedTime",
                "Description",
                "Title",
                "Author",
                "OriginalPath",
                "UniqueId",
                "SiteID",
                "WebId",
                "SiteLogo",
                "People",
                "AuthorOWSUSER",
                "Created",
                "WebTemplate",
                "GroupId",
                "PrivacyIndicator"
            ]
        },
        "Properties": {
            "results": [
                {
                    "Name": "EnableDynamicGroups",
                    "Value": {
                        "BoolVal": true,
                        "QueryPropertyValueTypeIndex": 3
                    }
                }
            ]
        },
        "HitHighlightedProperties": {
            "results": []
        },
        "RefinementFilters": {
            "results": []
        }
    }
}

 

 

When the response has some results, there is no problem.

 

But when this request has no result, for one specific tenant, the response has this body:

 

{
    "odata.metadata": ".../_api/$metadata#Microsoft.Office.Server.Search.REST.SearchResult",
    "ElapsedTime": 35,
    "PrimaryQueryResult": null,
    "Properties": [ ... ],
    "SecondaryQueryResults": [ ... ],
    "SpellingSuggestion": "",
    "TriggeredRules": [ ... ]
}

 

=> The problem here is that PrimaryQueryResult is null, unlike all other tenants.

 

For other tenants, the response is below when no result:

 

{
    "odata.metadata": ".../_api/$metadata#Microsoft.Office.Server.Search.REST.SearchResult",
    "ElapsedTime": 32,
    "PrimaryQueryResult": {
        "CustomResults": [],
        "QueryId": "762be03b-ae4f-438e-984d-4f81d2416506",
        "QueryRuleId": "00000000-0000-0000-0000-000000000000",
        "RefinementResults": null,
        "RelevantResults": {
            "GroupTemplateId": null,
            "ItemTemplateId": null,
            "Properties": [ ... ],
            "ResultTitle": null,
            "ResultTitleUrl": null,
            "RowCount": 0,
            "Table": {
                "Rows": []
            },
            "TotalRows": 0,
            "TotalRowsIncludingDuplicates": 0
        },
        "SpecialTermResults": null
    },
    "Properties": [ ... ],
    "SecondaryQueryResults": [],
    "SpellingSuggestion": "",
    "TriggeredRules": []
}

 

=> PrimaryQueryResult has a correct value and specifies that there are no result (TotalRows is 0).

 

What could cause this behavior?

In what cases can PrimaryQueryResult be null?

0 Replies