Auto-indexing
Introduction
When displaying an issue, the value of all its Calculated (Scripted) fields is re-computed on-the-fly. This means that the value of any Calculated field will always be up-to-date.
However, when searching for issues, Jira uses the Jira index, which stores the value of all standard and custom fields and is only updated when an issue is modified (or the index is re-built).
This is generally not a problem if the Groovy script of a Calculated field only refers to other fields of the current issue because if any of these other fields is modified, the issue will be considered as modified and thus the issue will be re-indexed by Jira. However, if the script accesses data from other, related issues, such as sub-tasks, linked issues, stories of an Epic, etc., the issue will not be re-indexed if one of the related issues is modified, which can lead to the index becoming obsolete for that issue, thus making search results incorrect.
To work around this limitation, JMCF can force Jira to re-index related issues when an issue is modified. However, this will increase the Jira workload and it should, therefore, be used with caution, and only on projects and/or issue types where it is needed, and only for the right issue relationships.
You can manage auto-indexing rule from Jira Misc Custom fields administration page
Log in to your JIRA Server instance as an administrator.
Go to the Administration.
Locate Add-ons from the menu and click on it.
Locate JIRA MISC CUSTOM FIELDS on the left panel.
Click on Automatic indexing
You are viewing the documentation for JMCF for Jira Data Center.
Manage auto indexing rules
Add an auto indexing rule
To add an auto-indexing rule:
Go to JMCF administration pages
Click on Automatic Indexing
Click on “Add auto indexing rule”
Select the Project, leave it blank for all projects
Select the Issue type, leave it blank for all issue types
Select the link to the related issues under “Which issues” (see below)
Click on “Save”
The rule will be created
Edit an auto-indexing rule
To add an auto-indexing rule:
Go to JMCF administration pages
Click on Automatic Indexing
Click on “Edit” for an auto-indexing rule
Modify the rule
Click on “Save”
The rule will be updated
Delete an auto-indexing rule
To add an auto-indexing rule:
Go to JMCF administration pages
Click on Automatic Indexing
Click on “Delete” for an auto-indexing rule
Click on “OK”
The rule will be deleted
Which issue(s)
Select the issues to operate on. They can be:
Parent issue of the current sub-task: Select this option to operate on the parent of the current issue
Sub-tasks of the current issue: Select this option to operate on the sub-tasks of the current issue
Epic of the current issue: Select this option to operate on the Epic of the current issue
Issues that belong to the current Epic: Select this option to operate on the issues that belong to the current Epic
Parent issue of the current issue in the Portfolio hierarchy: Select this option to operate on the parent issue of the current issue in the Portfolio hierarchy
Child issues of the current issue in the Portfolio hierarchy: Select this option to operate on the child issues of the current issue in the Portfolio hierarchy
Issues linked to the current issue through any link type: Select this option to operate on all issues linked to the current issue
Issues linked to the current issue through the following link type: Select this option and select the link type to operate only on issues linked through a specific link type
Issues returned by a Groovy script: Input a Groovy script that returns either a single Issue object, or a Collection of Issue objects, or a String representing the key of an issue, or a Collection of Strings each representing an issue key. For example:
"TEST-1"
["TEST-1","TEST-2"]
ComponentAccessor.issueManager.getIssueObject("TEST-1")
[ComponentAccessor.issueManager.getIssueObject("TEST-1"),ComponentAccessor.issueManager.getIssueObject("TEST-2")]
issue.parentObject
issue.getLinkedIssues()
Use case
Consider a case where you have a Calculated Multi-user field that displays the assignee of the subtasks of the Story. The calculated custom field script will be:
issue.subtasks*.assignee - null
If you change the “Assignee” of one of the subtasks and do not reindex the Story or edit the Story, then when you use the Issue navigator search with the Calculated Multi-user field the search will not display the right results since the Story has not been reindexed. To work around this add an auto-indexing rule to reindex the Story when the subtasks are modified.
Go to JMCF administration pages
Click on Automatic Indexing
Click on “Add auto-indexing rule”
Select the Issue Link as “Parent of the current issue”
Click on “Save”