Unable to get expected results by using CQL

webmethods-integration July 3, 2020

Hi

 

Below mentioned is the query I am using to find content/page based on page id, watcher and accountId of the member who has recently updated the page.

https://wmio12.atlassian.net/wiki/rest/api/content/search?cql=id=370802698 and contributor.accountid = '5cab1f74faab36165eb9cda1' and watcher.accountId ='5bc7427f65a8021356ab9f2a'

 

Issue related to Contributor field

Went through the CQL Advance searching Document and discovered that CQL field contributor.accountId works for both i.e created and editor.

So is there any key through with I can filter pages based on accountId of the user who has recently updated the page.

Issue related to Watcher field

In all other scenarios, the CQL watcher field works fine and returns proper results but when I pass creator accountID as a value to CQL watcher.accountId field the Query always returns result even if no watcher is watching the page.

So can some help me with this?

 

Regards,

Kuldeep Kushwaha

1 answer

1 vote
Diego
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 8, 2020

Hello @webmethods-integration !

As I understand, you are currently facing some issues while creating a CQL query and sending it via REST to Confluence on the Cloud.

To try and address your first question:

 “So is there any key through with I can filter pages based on accountId of the user who has recently updated the page.”

I got this query:

https://myconfluence.atlassian.net/wiki/rest/api/content/search?cql=lastModified>=2020-07-07%AND%contributor="668085:c45b1b9b-1d3d-5579-9e20-cc175cb2000d"

You can swap the actual date (in the example above 2020-07-07) with one of these functions:

  •     endOfDay()
  •     endOfMonth()
  •     endOfWeek()
  •     endOfYear()
  •     startOfDay()
  •     startOfMonth()
  •     startOfWeek()
  •     startOfYear()

And in place of the accountID value for the contributor field, you could use:

contributor.fullname=”Contributor Fullname”

Where “Contributor Fullname” should be replaced with the actual user's full name.

The query used as an example will look for content which the lastModified date (last time someone edited that content) that is bigger or equal to 2020-07-07 and has the contributor set to the specified accountID.

You can look for more details about the CQL Field here:

 

The second situation might be addressed by this bug:

 

It seems that the Watch and Stop Watching actions do not trigger a reindex of the current content. I was able to replicate the behavior you explained and worked around it by using the “Star this page” action on the same page I was querying with CQL. The star action is triggered by clicking the start icon at the top right corner.

The “Star this page” action did trigger the reindex and when I sent the same query to look for content with watchers, the result was updated.

 

Let us hear from you!

josef
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 16, 2024

Bug in 2nd situation should be fixed now

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events