Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Replacement for IssueIdFilter in Jira 8

PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 22, 2019

I had a custom JQL function using scriptrunner that borrowed a line of code from https://community.atlassian.com/t5/Marketplace-Apps-Integrations/create-jql-function-which-executes-sql-and-puts-results-to-the/qaq-p/305703 suggested by @Jamie Echlin _ScriptRunner - The Adaptavist Group_ 

new ConstantScoreQuery(new IssueIdFilter(issueIds))

But com.atlassian.jira.issue.search.filters.IssueIdFilter doesn't seem to exist anymore in Jira 8.

Does anyone know what the equivalent should be?

Or is that so old that it wasn't a good approach anyway?

1 answer

1 accepted

1 vote
Answer accepted
Jamie Echlin _ScriptRunner - The Adaptavist Group_
Atlassian Partner
August 23, 2019

There is no obvious replacement. What we do is, add the following class:

import com.atlassian.jira.issue.index.DocumentConstants
import org.apache.lucene.search.TermInSetQuery
import org.apache.lucene.util.BytesRef

class IssueIdsQuery extends TermInSetQuery {

IssueIdsQuery(Collection<String> ids) {
super(DocumentConstants.ISSUE_ID, ids.collect { new BytesRef(it) })
}
}

then replace:

new ConstantScoreQuery(new IssueIdFilter(issueIds))

 

with:

new IssueIdsQuery(issueIds)
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 23, 2019

Thanks, works like a charm.

Suggest an answer

Log in or Sign up to answer