Hi,
I have a datepicker custom field. We modify this customfield from outside of Jira via some scripting. But till index-optimization which occurs at midnights we can't see any change in our dashboard filters regarding this customfield. I think this is because we do not re-index issue during external modification. Is there a way to trigger a re-index process for a spesific issue (the one whose customfield is modified from outside)? Maybe listeners? It would be great to see some sample code which listens any changes about a customfield and perfoms a reindex for the involved issue.
Thank you
I think the better solution would be to stop manipulating the db directly, and change your external process to use jira's soap or rest APIs.
But the script runner has a built-in script to reindex issues either from a project or a query, you could use that or look at the code.
Alternatively write a service that compares the value provided by the jira API with the one in the database, and reindex accordingly. Of all the options I'd go for 1).
Hi, I think one sollution is implement own Reindexed Date CF Type and force reindex in create/update method.
public class ReindexDateCFType extends DateCFType { private static final Logger log = Logger.getLogger(ReindexDateCFType.class); private final IssueIndexManager issueIndexManager; public ReindexDateCFType( CustomFieldValuePersister customFieldValuePersister, DatePickerConverter dateConverter, GenericConfigManager genericConfigManager, DateTimeFieldChangeLogHelper dateTimeFieldChangeLogHelper, DateFieldFormat dateFieldFormat, DateTimeFormatterFactory dateTimeFormatterFactory, IssueIndexManager issueIndexManager) { super(customFieldValuePersister, dateConverter, genericConfigManager, dateTimeFieldChangeLogHelper, dateFieldFormat, dateTimeFormatterFactory); this.issueIndexManager = issueIndexManager; } @Override public void createValue(CustomField field, Issue issue, Object value) { super.createValue(field, issue, value); reindexIssue(issue); } @Override public void updateValue(CustomField field, Issue issue, Object value) { super.updateValue(field, issue, value); reindexIssue(issue); } private void reindexIssue(Issue issue) { try { boolean origVal = ImportUtils.isIndexIssues(); ImportUtils.setIndexIssues(true); issueIndexManager.reIndex(issue.getGenericValue()); ImportUtils.setIndexIssues(origVal); } catch (IndexException ie) { log.error("Unable to reindex issue: " + issue.getString("key") + ", [id=" + issue.getLong("id") + "].", ie); } } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It won't, not without polling the db, which you don't want to do.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you mean here direct manipulation of DB? Or modifying this customfield via JIRA API? If the former, then mere reindexing may be insufficient and listeners will be not called at all (they are not DB triggersm, listeners are triggered only when issues are changed "legally" using JIRA API stack), if the latter it should be needed at all.
Nevertheless: take a look at com.atlassian.jira.issue.index.IssueIndexManager - more precisely at its reIndex(Issue) method.
You can easily inject IssueIndexManager implementaiton to any spring/pico managed component or retrieve it statically via com.atlassian.jira.ManagerFactory#getIndexManager or via com.atlassian.jira.ComponentManager#getIndexManager.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.