Closed Bug 920060 Opened 11 years ago Closed 11 years ago

Bug.search API doesn't return total results

Categories

(bugzilla.mozilla.org :: API, defect)

Development
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: erik.bryn, Assigned: glob)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

In order to paginate a list of search results, a client needs to know if there are more results to display. I propose that a total results count should be returned.
as our methods don't support pagination, you're always getting the full number of bugs returned as search results (up to a maximum upper limit of 10,000).

to determine the total number of results, can't you count the bugs returned by the query?
Flags: needinfo?(erik.bryn)
TIL our webservices do support offset as well as limit (we don't use it in our UI however).

my concern with this is we'll have to execute each query twice to determine the total, which i'd like to avoid if possible.  i'll discuss this with dkl and see what we can do here.
Flags: needinfo?(erik.bryn)
Assignee: nobody → glob
Status: UNCONFIRMED → NEW
Ever confirmed: true
From what I understood, because of the volume of data we request in our queries, a lot of time spent is actually transmitting the data back to the webhead, and not the query itself. So wouldn't a query that just asks for a result count not take as long?
Attached patch 920060_1.patchSplinter Review
adds ember/search method which takes the same parameters as GET /bug?, and returns a total:

{ bugs: [ ... ],
  total: 12 }

this total is always set.  for searches without pagination (both offset+limit params) this is always equal to the count of bugs returned.  for paginated searches, the total is equal to the number of bugs matched.
Attachment #809305 - Flags: review?(dkl)
Comment on attachment 809305 [details] [diff] [review]
920060_1.patch

Review of attachment 809305 [details] [diff] [review]:
-----------------------------------------------------------------

r=dkl
Attachment #809305 - Flags: review?(dkl) → review+
Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bmo/4.2/
modified Bugzilla/Search.pm
modified Bugzilla/WebService/Bug.pm
modified extensions/Ember/lib/WebService.pm
Committed revision 9037.

Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bmo/4.2-dev/
modified Bugzilla/Search.pm
modified Bugzilla/WebService/Bug.pm
modified extensions/Ember/lib/WebService.pm
Committed revision 8562.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: