I have a listener that adds a label when the version of a ticket is changed. This works without any problems but when i want to search issues that have the label, i get no results.
Do i need another step after the label has been added to update the ticket somehow? When reindexing the project, I get the results i want but i shouldn't reindex the whole project each time a fixversion is updated.
if (lastVersion != newVersion) {
def labels = labelManager.getLabels(issue.id).collect{it.getLabel()}
labels += 'Updated'
labelManager.setLabels(user,issue.id,labels.toSet(),false,false)
}
I once wrote a post function that required re-indexing a just-modified issue, and here's the code that I used. You may try adding this after your setLabels() call.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.index.IssueIndexingService
def indexManager = ComponentAccessor.getComponent(IssueIndexingService.class)
indexManager.reIndex(issue)
Hi Lander,
It indeed sounds like you will need to re-index. :-(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Right now I'm testing with the addLabel() method and I see good results. I'll come back on that tomorrow.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.