Skip to end of banner
Go to start of banner

Auto-indexing

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

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

  1. Log in to your JIRA Server instance as an administrator.

  2. Go to the Administration.

  3. Locate Add-ons from the menu and click on it.

  4. Locate JIRA MISC CUSTOM FIELDS on the left panel.

  5. Click on Automatic indexing

On this page:

Manage auto indexing rules

Add an auto indexing rule

To add an auto-indexing rule:

  1. Go to JMCF administration pages

  2. Click on Automatic Indexing

  3. Click on “Add auto indexing rule”

  4. Select the Project, leave it blank for all projects

  5. Select the Issue type, leave it blank for all issue types

  6. Select the link to the related issues under “Which issues” (see below)

  7. Click on “Save”

  8. The rule will be created

Edit an auto-indexing rule

To add an auto-indexing rule:

  1. Go to JMCF administration pages

  2. Click on Automatic Indexing

  3. Click on “Edit” for an auto-indexing rule

  4. Modify the rule

  5. Click on “Save”

  6. The rule will be updated

Delete an auto-indexing rule

To add an auto-indexing rule:

  1. Go to JMCF administration pages

  2. Click on Automatic Indexing

  3. Click on “Delete” for an auto-indexing rule

  4. Click on “OK”

  5. 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 TEST

    • project = ${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.

  1. Go to JMCF administration pages

  2. Click on Automatic Indexing

  3. Click on “Add auto-indexing rule”

  4. Select the Issue Link as “Parent of the current issue”

  5. Click on “Save”


  • No labels