Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Why doesn't IssueService.update() reindex for DO_NOT_DISPATCH events?

David Yu April 25, 2015

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:

Test #1: issueService.update(event.getUser(), updateValidationResult, com.atlassian.jira.event.type.EventDispatchOption.ISSUE_UPDATED, false);

Result: No reindex on issue. Change is however saved in the database and viewing the issue shows the correct value.

Test #2: issueService.update(event.getUser(), updateValidationResult, com.atlassian.jira.event.type.EventDispatchOption.DO_NOT_DISPATCH, false);

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.

 

 

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
David Yu July 16, 2015

https://jira.atlassian.com/browse/JRA-43580 

Looks like this is documented behavior now.

1 vote
David Renaud July 16, 2015
0 votes
Volodymyr Krupach
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.
April 25, 2015

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);
David Yu April 26, 2015

It works with ISSUE_UPDATED_ID but in my case, I do not wish to fire this event because it will cause a notification.

Volodymyr Krupach
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.
April 26, 2015

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.

TAGS
AUG Leaders

Atlassian Community Events