Bug 1956944 - Search order by last change time using the REST API
Summary: Search order by last change time using the REST API
Keywords:
Status: CLOSED DUPLICATE of bug 1264787
Alias: None
Product: Bugzilla
Classification: Community
Component: Query/Bug List
Version: 5.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jeff Fearn 🐞
QA Contact: Utkarsh
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-04 17:51 UTC by Tristan Cacqueray
Modified: 2021-05-06 11:30 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-06 02:24:14 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1264787 1 low NEW Document the 'order' parameter of Bug.search 2021-05-06 02:24:10 UTC

Description Tristan Cacqueray 2021-05-04 17:51:05 UTC
Description of problem:

The REST API search endpoint does not seem to support the `order` parameter.
We would like to query bugs ordered by the last_change_time, so that we can safely use offset + limit to advance in time.


Steps to Reproduce:

Using this base query (for bugs with external links):

```
BZQ=https://bugzilla.redhat.com/rest/bug?limit=5&include_fields=summary,id,last_change_time,creation_time&f1=ext_bz_bug_map.ext_bz_bug_id&o1=isnotempty
```

1. curl ${BZQ}&order=Last Updated
2. curl ${BZQ}&order=Last Updated&chfieldfrom=2021-04-04


Actual results:

1. Bugs ordered by creation time
2. Bugs updated after 2021-04-04, ordered by creation time


Expected results:

The bugs should be ordered by their last update time.

To work around that limitation, we need to collect all the bugs and compute what is the last update time.
Then for the next query, we can start over from this date using the `chfieldfrom` parameter.
However this can miss bug that are updated during the collection.


Additional info:

A sort order (ascending/descending) would be useful too.

Setting order to `last_change_time` does not seem to work either.

Comment 1 Jeff Fearn 🐞 2021-05-04 23:15:57 UTC
'order=changeddate' seems to work, as does 'order=changeddate DESC'.

Comment 2 Tristan Cacqueray 2021-05-05 00:08:56 UTC
Thanks, that works. Is this documented somewhere?

Comment 3 Jeff Fearn 🐞 2021-05-05 00:21:19 UTC
No, there is a bug to document it, but it bridges the internal/external divide so is pretty ugly.

Comment 4 Jeff Fearn 🐞 2021-05-06 02:24:14 UTC

*** This bug has been marked as a duplicate of bug 1264787 ***

Comment 5 Tristan Cacqueray 2021-05-06 11:30:40 UTC
Thank you Jeff for the quick solution.


Note You need to log in before you can comment on or make changes to this bug.