Closed Bug 918362 Opened 11 years ago Closed 11 years ago

The "order" parameter passed to Bug.search is ignored

Categories

(Bugzilla :: WebService, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 5.0

People

(Reporter: dkl, Assigned: dkl)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

Not sure how I missed this but here is the fix:

=== modified file 'Bugzilla/WebService/Bug.pm'
--- Bugzilla/WebService/Bug.pm	2013-09-18 15:08:32 +0000
+++ Bugzilla/WebService/Bug.pm	2013-09-19 15:45:02 +0000
@@ -504,7 +504,7 @@
         ThrowUserError('buglist_parameters_required');
     }
 
-    $options{order_columns} = [ split(/\s*,\s*/, delete $match_params{order}) ] if $match_params{order};
+    $options{order}  = [ split(/\s*,\s*/, delete $match_params{order}) ] if $match_params{order};
     $options{params} = \%match_params;
 
     my $search = new Bugzilla::Search(%options);


Will do a proper patch for hopefully quick review.

dkl
Attached patch Patch to fix sorting in Bug.search (v1) (obsolete) β€” β€” Splinter Review
Attachment #807233 - Flags: review?(LpSolit)
Depends on: 477601
Comment on attachment 807233 [details] [diff] [review]
Patch to fix sorting in Bug.search (v1)

Despite this change is correct, it has no effect as you then call new_from_list() which always sorts the buglist by ID.
Attachment #807233 - Flags: review?(LpSolit) → review-
Summary: Sorting by order using Bug.search is not working due to improperly names parameter to Bugzilla::Search->new → Sorting by order using Bug.search is not working due to improperly named parameter to Bugzilla::Search and use of new_from_list
Attachment #807233 - Attachment is obsolete: true
Attachment #807329 - Flags: review?(LpSolit)
Comment on attachment 807329 [details] [diff] [review]
Patch to fix sorting in Bug.search (v2)

>+    # Bugzilla::Bug->new_from_list always sorts by bug id so we need to use a hash
>+    # to get the bugs back in the order requested by the client before converting
>+    # to bug hashes.

I honestly don't think this comment is useful. The trick used here is used "everywhere" now, for performance reasons. You can simply drop it, IMO. r=LpSolit
Attachment #807329 - Flags: review?(LpSolit) → review+
Flags: approval?
Summary: Sorting by order using Bug.search is not working due to improperly named parameter to Bugzilla::Search and use of new_from_list → The "order" parameter passed to Bug.search is ignored
Blocks: 918461
Flags: approval? → approval+
Committing to: bzr+ssh://dlawrence%40mozilla.com@bzr.mozilla.org/bugzilla/trunk
modified Bugzilla/WebService/Bug.pm
Committed revision 8749.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Blocks: 1126176
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: