Closed Bug 919852 Opened 11 years ago Closed 11 years ago

Add ability to perform quicksearch using Bug.search

Categories

(Bugzilla :: WebService, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 5.0

People

(Reporter: dkl, Assigned: dkl)

References

Details

Attachments

(1 file, 1 obsolete file)

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
(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.
Attached patch 919852_1.patch (obsolete) — Splinter Review
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-
Attached patch 919852_2.patchSplinter Review
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
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
Closed: 11 years ago
Resolution: --- → FIXED
Blocks: 922684
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: