I have a CQL(Confluence Query Language) query:
код=P
and this query gives me two results:
How is it possible to execute this code in Confluence ScriptRunner? I mean execute cql query in Confluence Script Runner like it can be done in Jira ScriptRunner.
I've tried to use Jira ScriptRunner code, but Jira code is not working in Confluence Script Runner:
String JqlQuery = "issueType = Epic AND project = HH AND 'Epic Name' = 'epic name'"
def parseResult = searchService.parseQuery(curUser, JqlQuery)
def searchResult = searchService.search(curUser, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
I've gone through quite a few discussions on this and have made two groovy scripts for two CQL query use cases. These can easily be modified as per requirements.
I know this post was from 2019, but I still think this is very useful. Hi from 2023 👋
1. Get values from the title column of a CQL query's results.
2. Add groups to Space permissions of the Spaces returned by a CQL query (this only works if the query contains type=space)
Do I understand correctly that these types of queries can not be executed in Cloud?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use the `CQLSearchUtils` class for this.
import com.onresolve.scriptrunner.canned.confluence.utils.CQLSearchUtils
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
def cqlSearchUtils = ScriptRunnerImpl.scriptRunner.getBean(CQLSearchUtils)
def cql = "space = FOOBAR"
def results = cqlSearchUtils.searchForContent(cql)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried the same, but getting error message:
groovy.lang.MissingMethodException: No signature of method: com.onresolve.scriptrunner.canned.confluence.utils.CQLSearchUtils.searchForContent() is applicable for argument types: (String) values: [space = AP]
at Script96.run(Script96.groovy:8)
Here is the script we tried on the scriptrunner console:
import com.onresolve.scriptrunner.canned.confluence.utils.CQLSearchUtils
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
def cqlSearchUtils = ScriptRunnerImpl.scriptRunner.getBean(CQLSearchUtils)
def cqlQuery = 'space = AP' // some CQL query
def pages = cqlSearchUtils.searchForContent(cqlQuery)
Any suggestions?
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import com.onresolve.scriptrunner.canned.confluence.utils.CQLSearchUtils
import com.onresolve.scriptrunner.canned.confluence.utils.CQLSearch
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
def cqlSearchUtils = ScriptRunnerImpl.scriptRunner.getBean(CQLSearchUtils)
def cqlQuery = 'space = KNOW' // some CQL query
def cqlSearch = new CQLSearch()
def pages = cqlSearchUtils.searchForPages(CQLSearch.fromQuery(cqlQuery))
pages.each{ page ->
log.warn page
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.