reindex issue after SIL script custom field return value changes

Sergey Tverdyukov January 23, 2013

Hello!

I have SIL script custom field updated but not visible in search.

Are there some methods to automaticaly reindex issue when return value changes?

Manualy reindex JIRA is not a solution.

1 answer

1 accepted

1 vote
Answer accepted
Florin Manaila
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.
January 23, 2013

Hi Sergey,

The SIL Script CF has multiple searchers available, depending on what type of value it holds. You can go to Administration->Custom Fields and on the "Edit" screen you should be able to choose which type of searcher you want. Note that changing the searcher, the name of the CF or the SIL script behind it requires a reindex. You should normally not need to manually reindex when the value changes, since it is automatically reindexed.

I don't understand if the problem is that the field is not searchable or if the values shown in search are incorrect.

Sergey Tverdyukov January 23, 2013

I have this code to change 2 custom fields and return task overdue in SIL fileld.

string format = "yyyy.MM.dd HH:mm:ss";
string[] my_statuses;
string[] my_statusHistory = fieldHistory(key, "status");
date my_startDate;
date my_endDate;
date my_finalDate;
for(number i = 1; i < size(my_statusHistory); i = i + 2) {
 string my_statusStr = getElement(my_statusHistory, i);
if (my_statusStr == "3" && isNull(my_startDate)) {
  my_startDate = arrayGetElement(my_statusHistory, i - 1);
  }
if (my_statusStr == "5") {
  my_endDate = arrayGetElement(my_statusHistory, i - 1);
}
}

if (isNull(my_startDate) && (customfield_10611 != created)) {
  customfield_10611 = created;
} else if (isNotNull(my_startDate) && (customfield_10611 != my_startDate)) {
  customfield_10611 = my_startDate;
}

if (isNull(my_endDate) && (customfield_10612 != customfield_10107)) {
  customfield_10612 = customfield_10107;
} else if (isNotNull(my_endDate) && (customfield_10612 != my_endDate)) {
  customfield_10612 = my_endDate;
}

return ((customfield_10611 > customfield_10107) || (customfield_10612 > customfield_10107) || ((currentDate() > customfield_10107) && (customfield_10612 >= customfield_10107)));

SIL field have exact text seacher. But the values shown in search are incorrect. Manual reindex helps.

Florin Manaila
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.
January 23, 2013

What versions of JIRA, keplercf and katl-commons are you using? I'm running into some other problems while trying to reproduce this.

Sergey Tverdyukov January 23, 2013

JIRA 5.2.1

Kepler Custom Fields 2.1.4

katl-commons 2.0.10

Florin Manaila
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.
January 23, 2013

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

This explains why searching is not working. It's old, but it still applies.

Florin Manaila
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.
January 23, 2013

So the problem goes like this: The script should be read-only. You should not be able to modify the fields from the script and there's a good reason for that. If you modify any field, it will trigger a reindex on the issue. The reindex will try to get all the values of the custom fields (including the SIL script) and will re-run the script, which will trigger another reindex and so on and it should start spinning. We have implemented a mechanism to prevent this from getting into an infinite loop. It surprises me that you say this works (as you said on the other thread) since it does start spinning when I try to reproduce this and it will show an empty value for the SIL script cf.

Unfortunately, I don't see a way to make the search work. The issue will be automatically reindexed when someone updates it or if there's a scheduled reindex. If you try to trigger the issue update from the script, you'll bump into the above problem.

Sergey Tverdyukov January 23, 2013

I had the problem you are talking about but solved it by updating fields only when they different. And I'll try to solve this task by making another custom field and update its value. I think this will trigger reindex. Am I right?

Florin Manaila
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.
January 23, 2013

You will encounter the problem whenever you modify any field. It works now because you didn't need to update any values yet. Even if we assume this works, it's still not enough since the script will be triggered when the issue is shown (or needed somewhere else). So you'll need to view the issue in order for the indexes to be updated.

Sergey Tverdyukov January 23, 2013

Think I got answer to my questions. Thank you! Didnt know that scripts triggered only when issue is viewed.

Florin Manaila
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.
January 23, 2013

You could give JJupin a try if you like. It has a bunch of other useful functionalities like conditions, validators, post-functions, services, listeners and more, all based on the SIL scripting language. We're also preparing some really useful new features to work with the issue UI, so stay tuned :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events