Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

re-index from Scriptrunner script

Deleted user September 21, 2017 edited

Hello,

i try to write an script that re-index Jira in the Background,

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.task.context.*
import com.atlassian.jira.task.context.Context
import com.atlassian.jira.util.index.IndexLifecycleManager

def indexLifecycleManager = ComponentAccessor.getComponent(IndexLifecycleManager.class)
def context = Context.Builder.build()

indexLifecycleManager.reIndexAllIssuesInBackground(context)

but it's not working.

No signature of method: static com.atlassian.jira.task.context.Context$Builder.build() is applicable for argument types: () values: [] Possible solutions: build(), find(), find(groovy.lang.Closure), split(groovy.lang.Closure), wait(), dump()

I try to google it but don't find anything. Did you guys got an idea what i should add/change?

kind regards

2 answers

0 votes
Sarah Kladstrup
Contributor
October 12, 2021

Did this ever get solved?

When I put your code into ScriptRunner's console, I get an error on the 

def context = Context.Builder.build()

line saying, "[Static type checking] - Non static method com.atlassian.jira.task.context.Context$Builder#build cannot be called from static context @ line 7, column 15."

Christoph Beer December 13, 2023

I searched for this a while as well but finally made it with:

 

def context = new Context.Builder().build()
Maybe it helps someone.
0 votes
adammarkham
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.
September 21, 2017

Hi Ricardo,

Is there a particular reason you want to write a script to do reindexing in the background, as opposed to the background reindexing provided by JIRA here?

Adam

Deleted user September 24, 2017

Yes we want to schedule the reindex as a jira service and its possible to set a script as a service

Ricardo 

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events