CQL execution inconsistencies on the REST API

Dear community,

I’d like to raise my concern, and ask for feedback about the execution of CQL-s on the Confluence Cloud REST API.
After extensive internal testing, I found some problems/inconsistencies on both the /api/search and the /api/content/search endpoints.
If I run a CQL that tries to filter on the type field multiple times, in some cases, the results are totally unexpected.

For both mentioned API-s I found the following issues:

  • type = page AND type = user returns all the pages, instead of an empty result. The same goes for any other combination with user (blogpost+user, space+user, and user+page, user+blogpost, user+space), these ignore the user filter.
  • type = page OR type = user returns only all the users, instead of all users+pages. Same for any other combination, these all return the users, and ignore the other filter.
  • type IN (page,user) returns only all the users, instead of all users+pages. Same for any other combination, these all return the users, and ignore the other filter.
  • type != page AND type = user, this returns 95 results. I have 18 users, no idea what happened here. The same goes for any other combination, they all return random number of results, except when the user is at the front (ex.: type != user AND type = page), which all work correctly.

According to my testing, other CQL-s like these, for example type=page AND type=blogpost all work correctly, and return the expected results according to the general rules of boolean algebra. The issues only happen when the user type is involved.

And by both API-s, I mean they really break in the same way, even though the api/content/search endpoint shouldn’t even support returning users. (as far as I know)

You might be wondering, why does this matter? These are obviously faulty cql-s right?
Well, yes, and no. We plan to give our users a way to enter custom CQL strings, but we have to filter anything they input to specific types in a hard-coded way. It’s entirely possible that the user inputs type=user for a field where we want to filter for type=page for example. Returning 0 results in this case is expected, but returning all pages is not.
Also, I think it’s important that the API works as developers would generally expect it, because we noticed these inconsistencies, but not everyone might do so.

What do you think? Has anyone else experienced the same?

2 Likes

Any reaction from the Atlassian staff?

We are ready to create a bug report for this, but if there is one existing already, we don’t want to create a duplicate.