I've searched answers and this seems to be a constant source of confusion. User updates an issue using IssueService, but the indexes don't get refreshed so search results do not reflect correctly. And the usual recommendation is to use IndexManager to manually reindex the issue.
The API docs for update state:
This method will store the provided issue to the JIRA datastore. This method will only update the issue if the current user has the edit permission within the specified project. The issue will be saved and re-indexed.
So assuming this is being done automatically, I try this experiment within an Event Listener:
I enable DEBUG logging on jira.issue.index.DefaultIndexManager:
Result: No reindex on issue. Change is however saved in the database and viewing the issue shows the correct value.
Result: Reindex occurs. Can see in logs [jira.issue.index.DefaultIndexManager] Reindexed 1 issues in 79ms.
Why does it behave differently based on the event dispatched? This isn't documented in the API from what I can tell. Is this a bug? This is with JIRA 6.3.14.
Community moderators have prevented the ability to post new answers.
If you do want to still use the DO_NOT_DISPATCH option you can work around it by calling ComponentAccessor.getIssueIndexManager().reIndex(issue) on the issue returned by the updateIssue function. This should be used sparingly though as it kills plugin performance in my experience.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please try to update without the EventDispatchOption parameter: https://docs.atlassian.com/jira/latest/com/atlassian/jira/bc/issue/IssueService.html#update(com.atlassian.jira.user.ApplicationUser,%20com.atlassian.jira.bc.issue.IssueService.UpdateValidationResult)
It fires EventType.ISSUE_UPDATED_ID and I remember it worked for me.
Here: https://answers.atlassian.com/questions/14201084 Dipenkumar Patel had the same problem and to resolve it he added following parameters:
issueInputParam.setRetainExistingValuesWhenParameterNotProvided(true,true); issueInputParam.setApplyDefaultValuesWhenParameterNotProvided(false); issueInputParam.setSkipScreenCheck(true);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess that reindexing code is listening for ISSUE_UPDATED_ID event. No event - no reindex :-). You may consider to use IssueIndexManager to launch reindexing for the update issue.
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.