Skip to content

Search API RefinementFilters without quotes no longer work #8615

@IvanTheBearable

Description

@IvanTheBearable

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

SharePoint REST API

Developer environment

macOS

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

Problem identified using the PnP Modern Search web part (v4.7). Problem reproduced, and workaround verified, using SharePoint Search query Tool v2.10.0.

Describe the bug / error

Sending a query to the search API (/_api/search/query or /_api/search/postquery) with an unquoted refinement filter has stopped working. For example, up until this month, the following query worked:

{
  "request": {
    "ClientType": "AllResultsQuery",
    "Querytext": "trafalgar",
    "SourceId": "efaea570-d6b3-45a5-992f-c43f71bfe3b5",
    "RefinementFilters": {
      "results": [
        "RefinableString113:101410"
      ]
    },
    "SelectProperties": {
      "results": [
        "RefinableString113",
        "RefinableString115",
        "RefinableString120"
      ]
    }
  }
}

Then, sometime around the end of October or beginning of November, this query stopped returning result. It doesn't error, it just returns no results.

The fix is to wrap the filter value in quotes like this:

{
  "request": {
    "ClientType": "AllResultsQuery",
    "Querytext": "trafalgar",
    "SourceId": "efaea570-d6b3-45a5-992f-c43f71bfe3b5",
    "RefinementFilters": {
      "results": [
        /* filter string wrapped in quotes */
        "RefinableString113:\"101410\""
      ]
    },
    "SelectProperties": {
      "results": [
        "RefinableString113",
        "RefinableString115",
        "RefinableString120"
      ]
    }
  }
}

This returns the expected results. The FQL documentation indicates that quotes are not required unless there is a space. Yes, they are recommended, and maybe should be required, but right now this causes some backwards compatibility issues.

Steps to reproduce

Send a postquery to the search api using a string refinement filter with no spaces, not wrapped in quotes. Similar to the example above (but with parameters modified to return results in your environment):

Expected behavior

Search results filtered by the supplied refiner value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:searchtype:archive-old-issueIssues which are closed as tool old for active worktype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions