It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

SearchRequest incompatibilities between Jira 3 and 5

I have the following piece of code from Jira 3.13

I need to convert this to use the api in 5.1.8 but, I'm having trouble determining how to do this now that both

the SearchRequest class and search() method now expect a Query and ResolutionParameter/UserParameter are no

longer available.

Any help is greatly appreciated.

private final static SearchSort SORT_ORDER = new SearchSort(NavigableField.ORDER_DESCENDING, IssueFieldConstants.PRIORITY);

private final static SearchSort SORT_ORDER2 = new SearchSort(NavigableField.ORDER_ASCENDING, IssueFieldConstants.CREATED);

private final static Collection<SearchSort> DEFAULT_SEARCH_SORTS = Arrays.asList(SORT_ORDER2, SORT_ORDER);

final SearchRequest sr = new SearchRequest(user.getName());
sr.addParameter(new UserParameter(DocumentConstants.ISSUE_ASSIGNEE, user.getName()));
sr.addParameter(ResolutionParameter.UNRESOLVED);
sr.setSearchSorts(DEFAULT_SEARCH_SORTS);
			
final SearchResults result;
try {
result = m_searchProvider.search(sr, user, PagerFilter.getUnlimitedFilter());


					
				
			
			
			
				
			
			
			
			
			
			
		

1 answer

0 votes
Timothy Community Leader May 21, 2013

You would need to refer to this documentation as the framework has changed alot.

This is a sample code:

JqlClauseBuilder jqlClauseBuilder = JqlQueryBuilder.newClauseBuilder();
Query query = jqlClauseBuilder.project(projectId).and().issueType("Epic").buildQuery();
query = jqlClauseBuilder.orderBy().addSortForFieldName(PRIORITY, SortOrder.ASC, true).buildQuery();
query = builder.buildQuery();
searchResults = searchService.search(user, query, PAGER_FILTER);

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Teamwork

Listening out loud: how Fabian Lopez works on distributed teams

The start of the COVID-19 pandemic served as a forcing function to re-evaluate the way teams worked together. In fact, many companies are re-learning how to collaborate with their teams. As some move...

58 views 2 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you