Search Components Query Pagination is not giving accurate results

Priya Ghosh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 26, 2025

Search Components Query is not returning proper results. We have 1249 components on compass while viewing on the UI , But when we use this GQL to query and get all components from compass , using end cursor. The end cursor is not null even though the component limit is achieved . The data is duplicate in the query response. It returns random count of data.
Is there any alternative approach to get proper count & results.
Query : GraphQL API

1 answer

1 vote
Pavel Shkleinik
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 28, 2025

Hello @Priya Ghosh ,

 

Sharing the script you are using to paginate through the search results would greatly help with the issue troubleshooting (but please don't share any auth credentials like emails/API tokens).

 

>> The data is duplicate in the query response.

Are you passing any sorting parameters? When no sorting parameters are passed, then search falls back to sorting by relevancy that can change while paging through since relevancy is not fully deterministic. FWIW here is an example search request with explicitly specified sort order:

const requestBody = {
variables: {
cloudId: CLOUD_ID,
query: {
first: 100,
"sort": [
{
"name": "title",
"order": "ASC"
}
],
},
},
query: SEARCH_QUERY,
};

 

I hope this helps.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events