Page 1 of 1

How to use lucene query in live report (live doc)

Posted: Tue Sep 25, 2018 3:20 am
by adbarads
So, I'm pretty familiar with using SQL in a live report. And putting the SQL query in a script block.
then using $sqlService.executeQuery()

I was curious if I can call a Lucene query instead, and have that returned like in an array or some other fashion like from a typical SQL query.

I am looking to see if there is a lucene query that will return all workitems (type:testcase and HAS_VALUE:custom_field).
and maybe return in an array.

Re: How to use lucene query in live report (live doc)

Posted: Tue Sep 25, 2018 5:54 am
by mhoe
In LiveReports you can do:
#set($workitems = $trackerService.queryWorkItems("type:testcase and HAS_VALUE:custom_field","id"))

I don't know if it is the same in LiceDocs, since there is used wiki code, but i am not familiar with that.

Also have a look at
https://almdemo.polarion.com/polarion/sdk/index.html

Re: How to use lucene query in live report (live doc)

Posted: Wed Sep 26, 2018 6:19 am
by adbarads
thanks, this was exactly what I needed.

full solution for anyone else that may need it:
#set($workitems = $trackerService.queryWorkItems("project.id:some_proj_id AND type:testcase AND HAS_VALUE:custom_field","id"))

can also do this for an array count:
$trackerService.queryWorkItems("projectid:some_proj_id AND type:testcase AND HAS_VALUE:custom_field","id").size()

basically it's call function and insert a lucene query.