Our new Appfire Documentation Space is now live!
Take a look here! If you have any questions please email support@appfire.com
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
On this page:
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:
Linked issues: Select issue(s) linked to the current issue through any link type or a specific link type such as
blocks
,is cloned by
, etc.Sub-tasks of the current issue: Select this option to operate on the sub-tasks of the current issue
Parent issue of the current sub-task: Select this option to operate on the parent 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
Epic of the current issue: Select this option to operate on the Epic of the current issue
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
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
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()
Issues returned by a JQL search: Input a JQL search expression, including an optional Groovy Template markup. For example:
project = TEST
returns issues of the project with the key TESTproject = ${issue.get("project").key} and assignee = ${currentUser.name}
returns issues of the project the current issue belongs to and assigned to the current user.To operate on issues of a project with key
TEST
and issue type name same as the value in a text field<% if (issue.get("Single line text")) { %> project = TEST and issuetype = ${issue.get("Single line text")} <% } else { %> issuekey=INVALID-1 <% } %>
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”