Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-79333

Using SpacesWithCreatePermission in CQL can cause 500 Internal Server Error

XMLWordPrintable

      Issue Summary

      When using CQL that searches over a large number of space, the REST search endpoint can return a 500 error. This is caused by the CQL being interpolated into a Lucene query that gets sent to the back end service, and the query exceeds the 2048 term limit.

      Steps to Reproduce

      1. Do a CQL search with
        /wiki/rest/api/content/search?cql=type = 'space' and space in spacesWithCreatePermission(<permission>)

      Expected Results

      The endpoint returns with the expected data.

      Actual Results

      The below exception is thrown

      "statusCode": 500,
      "message": "com.atlassian.confluence.api.service.exceptions.SSStatusCodeException: CQL was parsed but the search manager was unable to execute the search. Error message: com.atlassian.confluence.api.service.exceptions.SSStatusCodeException: There was an error returned from XP-Search Aggregator API: HTTP/1.1 500 Internal Server Error" 

      Workaround

      Option 1: Re-write the CQL to not use spacesWithCreatePermission.

      Option 2: App developers can use a cql query to search for spaces first: /wiki/rest/api/content/search?cql=type = 'space', and then use the space permission v2 api to filter the spaces based on user permissions.

              fd60b13e99e5 Praveen Singh
              jrichards@atlassian.com James Richards
              Votes:
              9 Vote for this issue
              Watchers:
              22 Start watching this issue

                Created:
                Updated:
                Resolved: