ClearQuest OSLC 2.0 query pagination not working as expected
I am running a query using the OSLC 2.0 REST API that returns ~6000 records. I am using rcm.startIndex and oslc.pageSize to get the records in pages of size 100. I would expect that page 1 would contain records 1-100, page 2 would contain records 101-200, etc. Instead, what is happening is that each page contains a seemingly random selection of 100 records out of the 6000. So instead of getting 6000 unique records, I end up with many duplicate records and some records are not returned.
The query looks like this:
GET https://clearquest.mycompany.com/cqweb/oslc/repo/REPO/db/DB/simpleQuery/12345678?oslc.where=cq:Product in ["ABC", "123"] and cq:State!="Closed" and cq:Modified_Date>"2015-09-15T16:00:00Z"&oslc.prefix=cq=<http://www.ibm.com/xmlns/prod/rational/clearquest/1.0/>&oslc.select=dcterms:identifier&rcm.startIndex=1&oslc.pageSize=100My algorithm works by increasing the startIndex by 100 until the total number of records are returned. I also tried using oslc.orderBy but I could not get that to work either.
Is this a limitation of the OSLC API? Or am I doing something wrong?
|
2 answers
I think that you have to find the attribute rdf:resource at the tag oslc.nextPage and use this url to retrieve the next page.
Comments
Aaron Lindsey
commented Oct 20 '15, 4:47 p.m.
Hi Fernando, unfortunately I tested it using the url in oslc.nextPage and got the same result. |
I don't see this randomness in my own environment with a much smaller result set. Do you still see the randomness if you tighten up the search conditions? Also, how do you execute the query? Within some custom code or just a browser? I'm wondering whether the query is executed in a new user session every time you run it, or the result sets have not been cached.
As for oslc.orderBy, according to a very old post, the feature may not be implemented at all. https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014791814 Comments
Aaron Lindsey
commented Oct 21 '15, 4:33 p.m.
Hi Donald, we tried to execute the query in a browser as well as using custom code and saw the same behavior for both. We noticed that if we remove cq:Product and cq:State filters from the oslc.where clause, the paging works as expected. It seems that we only see the randomness happening for certain oslc.where clauses.
Donald Nong
commented Oct 21 '15, 9:20 p.m.
That's a bit strange. In this case, it's probably related to the way the SQL statement is constructed. If you can reproduce this issue on purpose, I would suggest you open a ticket with Support to confirm whether this is a defect.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
Update: Even when I use the link in the oslc.nextPage attribute, I still see the same behavior. When I call the exact same URL more than once, I get a different set of results each time. It seems like no ordering is being enforced whatsoever.