Add ability to perform quicksearch using Bug.search

RESOLVED FIXED in Bugzilla 5.0

Status

()

Bugzilla
WebService
--
enhancement
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: dkl, Assigned: dkl)

Tracking

Bugzilla 5.0
Dependency tree / graph
Bug Flags:
approval +

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
Bug.search should be able to run a quicksearch style query by using the params returned from Bugzilla::Search::Quicksearch when passed the param 'quicksearch'.

Question: We can do this two ways. 

1) Just add the check for the 'quicksearch' parameter in the current Bug.search and replace the search params with what is returned by Bugzilla::Search::Quicksearch::quicksearch, or
2) Create a completely separate method called Bug.quicksearch (or .quick_search) that is called for doing quicksearch style queries only. We would then move the common code from Bug.search into a separate function that either Bug.search and Bug.quicksearch can call.

I would prefer personally just to expand Bug.search (option 1) instead of needed a new method as the code addition is not really that much anyway and also this is basically how buglist.cgi works.

Thoughts? And patch coming.

dkl

Comment 1

5 years ago
(In reply to David Lawrence [:dkl] from comment #0)
> I would prefer personally just to expand Bug.search (option 1) instead of
> needed a new method as the code addition is not really that much anyway and
> also this is basically how buglist.cgi works.

I vote for this.
 
> Thoughts? And patch coming.

If for no other reason than that is what brc does currently (since 4.2) :)
I vote for expanding Bug.search as well.  It only makes sense.  As you said, buglist.cgi already works that way in the user-facing version.
Duplicate of this bug: 919602
(Assignee)

Comment 4

5 years ago
Created attachment 809369 [details] [diff] [review]
919852_1.patch

1) Bugzilla::Search::Quicksearch::_is_webservice can be replaced with i_am_webservice() in bug 917669 when it lands.
2) Most of the code changes in Bug.search was cleanup to use $match_params properly.

dkl
Attachment #809369 - Flags: review?(glob)
Comment on attachment 809369 [details] [diff] [review]
919852_1.patch

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

this mostly looks good.
support of quicksearch deserves a mention in the perldoc :)

::: Bugzilla/Search/Quicksearch.pm
@@ +310,3 @@
>          my $bug_id = Bugzilla->dbh->selectrow_array(
>              q{SELECT bug_id FROM bugs WHERE alias = ?}, undef, $alias);
>          # If the user cannot see the bug, do not resolve its alias.

update this comment to reflect the change in behaviour.

@@ +319,5 @@
> +        elsif ($bug_id) {
> +            my $cgi = Bugzilla->cgi;
> +            $cgi->param('bug_id', $bug_id);
> +            $cgi->param('bug_id_type', 'anyexact');
> +            return 1;

if we get an alias which the user can't access, the behaviour should be to perform a normal search for it as a string, not to search on the private bug's id.
Attachment #809369 - Flags: review?(glob) → review-
(Assignee)

Comment 6

5 years ago
Created attachment 810730 [details] [diff] [review]
919852_2.patch
Attachment #809369 - Attachment is obsolete: true
Attachment #810730 - Flags: review?(glob)
Comment on attachment 810730 [details] [diff] [review]
919852_2.patch

r=glob
Attachment #810730 - Flags: review?(glob) → review+
Flags: approval+
Target Milestone: --- → Bugzilla 5.0
(Assignee)

Comment 8

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

Updated

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