Closed Bug 76498 Opened 23 years ago Closed 10 years ago

QuickSearch: support comparison operators other than substring

Categories

(Bugzilla :: Query/Bug List, enhancement, P2)

2.11
enhancement

Tracking

()

RESOLVED FIXED
Bugzilla 5.0

People

(Reporter: afranke, Assigned: glob)

References

Details

(Whiteboard: [wanted-bmo])

Attachments

(1 file, 3 obsolete files)

Currently the generic notation for a word is field1,...,fieldN:value1,...,valueM
and a bug matches iff one of the values occurs as a _substring_ in one of the
fields. This should be generalized to allow other comparison operators like
"regexp", "exact", and probably more.

Question 1: Should there be a possibility to specify the comparison operator for
each value, or is it sufficient to have the same comparison operator for all
values. You can always use multiple words with an OR (or "|") between them to
achieve different operators for different values, but it may still be more
natural in some cases to indicate the comparison operator together with the
value, e.g. it would be easy to implement that everything between /.../ is
treated as a regexp. But there are other solutions.

Then the main challenge is to find a good syntax for each of these operators.
A single ":" is used for substring. I can think of two possible approaches:
I.) use other characters _instead_ of the colon
	e.g. foo,bar=1,2,3 could be used for exact matching
II.) use more characters _in addition to_ the colon
	e.g. foo,bar:=1,2,3 could be used for exact matching

"::" is very easy to type, so it should be used for a frequently used operator.
Target Milestone: --- → Future
Component: Bugzilla → Query/Bug List
Product: Webtools → Bugzilla
Version: Bugzilla 2.11 → 2.11
.
Assignee: nobody → nobody
Depends on: 70907
QA Contact: mattyt-bugzilla → default-qa
Target Milestone: Future → ---
Priority: -- → P4
Attached file buy cheap paxil (obsolete) (deleted) —
(spam deleted)
The content of attachment 263723 [details] has been deleted by
    Dave Miller (work related) <justdave@mozilla.com>
who provided the following reason:

Attachment was spam.

The token used to delete this attachment was generated at 2007-05-04 08:36:50 PDT.
Assignee: nobody → query-and-buglist
Depends on: 688967
For numeric fields such as "votes", I'd like < and > operators.
I also would like <,> for days_elapsed
I'm not convinced days_elapsed does anything sane in quicksearch in any case

I get 180 bugs (mostly very old) for
https://bugzilla.mozilla.org/buglist.cgi?quicksearch=%3AXBL

For one day elapsed (of which there's only one) I get 70 bugs (mostly very old):
https://bugzilla.mozilla.org/buglist.cgi?quicksearch=%3AXBL%20days_elapsed%3A1

As I increment the days_elapsed I get smaller and larger numbers that seem to have nothing to do with the changed date.
Whiteboard: [wanted-bmo]
Assignee: query-and-buglist → glob
No longer depends on: 688967
Attached patch 76498_1.patch (obsolete) — Splinter Review
getting quicksearch to support this is relatively simple, the hard bit will be deciding on a syntax which causes the least amount of breaking of existing queries.

here's a patch which adds new symbols which can be used instead of :

eg. creation_ts<-2w does "creation_ts" "lessthan" "-2w"

the full map is:
 ':'  => 'substring',
 '='  => 'equals',
 '!=' => 'notequals',
 '>=' => 'greaterthaneq',
 '<=' => 'lessthaneq',
 '>'  => 'greaterthan',
 '<'  => 'lessthan',
Attachment #803068 - Flags: review?(simon)
Comment on attachment 803068 [details] [diff] [review]
76498_1.patch

The patch is good (very good in fact), but you need to update the documentation with this functionality as well (template/en/default/pages/quicksearch.html.tmpl)
Attachment #803068 - Flags: review?(simon) → review-
Attached patch 76498_2.patch (obsolete) — Splinter Review
Attachment #803068 - Attachment is obsolete: true
Attachment #8345700 - Flags: review?(simon)
Comment on attachment 8345700 [details] [diff] [review]
76498_2.patch

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

::: template/en/default/pages/quicksearch.html.tmpl
@@ +234,5 @@
> +        where the <kbd>summary</kbd> is not <kbd>foo</kbd>.
> +      </li>
> +      <li>
> +        <strong>&gt;</strong> (greaterthan):<br>
> +        <kbd><em>creation_ts>-2w</em></kbd> will search for [% terms.bugs %]

Replace > with &gt; Same with the documentation for >=

@@ +246,5 @@
> +        terms.bugs %] exactly two weeks old.
> +      </li>
> +      <li>
> +        <strong>&lt;</strong> (lessthan):<br>
> +        <kbd><em>creation_ts>-2w</em></kbd> will search for [% terms.bugs %]

Replace > with &lt; . Same with the documentation for <=
Attachment #8345700 - Flags: review?(simon) → review-
It looks like this patch is close to r+. glob: could you update it, please?
Status: NEW → ASSIGNED
OS: Other → All
Hardware: Other → All
Target Milestone: --- → Bugzilla 5.0
Attached patch 76498_3.patchSplinter Review
Attachment #8345700 - Attachment is obsolete: true
Attachment #8360238 - Flags: review?(LpSolit)
Comment on attachment 8360238 [details] [diff] [review]
76498_3.patch

Please backport it to bmo asap! :) r=LpSolit
Attachment #8360238 - Flags: review?(LpSolit) → review+
Flags: approval?
Keywords: relnote
Priority: P4 → P2
Summary: QuickSearch: comparison operators other than substring → QuickSearch: support comparison operators other than substring
Comment on attachment 8360238 [details] [diff] [review]
76498_3.patch

>=== modified file 'Bugzilla/Search/Quicksearch.pm'
>-    my @field_values = _parse_line(':', 1, $or_operand);
>-    if (scalar @field_values == 2) {
>-        my @fields = _parse_line(',', 1, $field_values[0]);
>-        my @values = _parse_line(',', 1, $field_values[1]);
>+        my @field_values = parse_line($symbol, 1, $or_operand);
>+        next unless scalar @field_values == 2;
>+        my @fields = parse_line(',', 1, $field_values[0]);
>+        my @values = parse_line(',', 1, $field_values[1]);

Just to be sure: replacing _parse_line() by parse_line() is intentional, isn't it?
This is way cool.  Make sure comment 17 is addressed, then commit at will.
Flags: approval? → approval+
We are releasing today and glob is not around, so I'm committing the patch myself.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/Search/Quicksearch.pm
modified template/en/default/pages/quicksearch.html.tmpl
Committed revision 8895.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
I had to fix bustage on Perl 5.10 and 5.12:

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/Search/Quicksearch.pm
Committed revision 8896.
(In reply to Frédéric Buclin from comment #17)
> Just to be sure: replacing _parse_line() by parse_line() is intentional,
> isn't it?

no, it isn't intentional, and reverts the fix in bug 877545 when searching for multiple values.
fixed:

Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/Search/Quicksearch.pm
Committed revision 8901.
Blocks: 997281
Added to relnotes for 5.0rc1.
Keywords: relnote
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: