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

RESOLVED FIXED in Bugzilla 5.0

Status

()

RESOLVED FIXED
5 years ago
4 years ago

People

(Reporter: dkl, Assigned: dkl)

Tracking

(Blocks: 1 bug)

Bugzilla 5.0
Dependency tree / graph
Bug Flags:
approval +

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
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
(Assignee)

Comment 1

5 years ago
Created attachment 807233 [details] [diff] [review]
Patch to fix sorting in Bug.search (v1)
Attachment #807233 - Flags: review?(LpSolit)

Updated

5 years ago
Depends on: 477601

Comment 2

5 years ago
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-
(Assignee)

Updated

5 years ago
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
(Assignee)

Comment 3

5 years ago
Created attachment 807329 [details] [diff] [review]
Patch to fix sorting in Bug.search (v2)
Attachment #807233 - Attachment is obsolete: true
Attachment #807329 - Flags: review?(LpSolit)

Comment 4

5 years ago
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+

Updated

5 years ago
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
(Assignee)

Updated

5 years ago
Blocks: 918461
Flags: approval? → approval+
(Assignee)

Comment 5

5 years ago
Committing to: bzr+ssh://dlawrence%40mozilla.com@bzr.mozilla.org/bugzilla/trunk
modified Bugzilla/WebService/Bug.pm
Committed revision 8749.
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED

Updated

4 years ago
Blocks: 1126176
You need to log in before you can comment on or make changes to this bug.