After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 789905 - Match any of the words in the search box
Match any of the words in the search box
Status: RESOLVED FIXED
Product: system-monitor
Classification: Core
Component: process list
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: System-monitor maintainers
System-monitor maintainers
Depends on:
Blocks:
 
 
Reported: 2017-11-04 14:58 UTC by Stefano Facchini
Modified: 2018-02-03 08:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proctable: Match any of the words in the search box (1.69 KB, patch)
2017-11-04 14:58 UTC, Stefano Facchini
none Details | Review
proctable: Accept a regex as search pattern (1.08 KB, patch)
2017-11-04 19:06 UTC, Stefano Facchini
none Details | Review
Support searching for multiple tokens (bgo#789905) (1.80 KB, patch)
2017-11-09 23:11 UTC, Robert Roth
none Details | Review

Description Stefano Facchini 2017-11-04 14:58:08 UTC
If I enter "polari nautilus" in the search box, I'd like to see polari and nautilus in the list, instead of nothing.
Comment 1 Stefano Facchini 2017-11-04 14:58:33 UTC
Created attachment 362968 [details] [review]
proctable: Match any of the words in the search box

We split the search text at spaces and match any of the tokens.
Comment 2 Benoît Dejean 2017-11-04 18:17:23 UTC
Hello Stefano, nice patch, but maybe we could simply accept regex syntax instead ?
Comment 3 Stefano Facchini 2017-11-04 19:06:18 UTC
Created attachment 362989 [details] [review]
proctable: Accept a regex as search pattern

Sure that would work, too, but maybe the regex syntax is a bit less friendly for the casual user...
Oh well, I'll just let you and Robert pick the patch you prefer :)
Comment 4 Robert Roth 2017-11-08 17:35:53 UTC
That's a tough decision :) System Monitor is already said to be too technical, but I'm still not sure whether I would like to have regexp search, I'm not sure what's the use-case. I tend to agree  that the standard use-case is to search word1 or word2, so the simple space-based token search would work better, and is easier. Benoit, what use-case do you see which is not fit for the token-based search but only works for regexp? 
I have never been in a situation to need regexp, and lacking this "composite search" I use the search pattern to reduce the length of the list, and then pick the process (usually the one I will kill) from the shortlist.
Comment 5 Benoît Dejean 2017-11-08 18:30:45 UTC
I see no use case for regex, but I wouldn't have though of "word1 word2" neither.
Maybe we could accept "word1|word2" as well by simply using g_strsplit_set ? :-)

Let's go for the first patch. We coud still implement it with regexes internally by splitting the words and create "w1|w2|w3" ?

This actually makes me thinking about implementing a view but I'm not sure what the UI could look like.
Comment 6 Robert Roth 2017-11-09 22:21:52 UTC
(In reply to Benoît Dejean from comment #5)
> I see no use case for regex, but I wouldn't have though of "word1 word2"
> neither.
> Maybe we could accept "word1|word2" as well by simply using g_strsplit_set ?
> :-)
> 
> Let's go for the first patch. We coud still implement it with regexes
> internally by splitting the words and create "w1|w2|w3" ?

Yes, using regexp internally makes sense, and we can accept both "word1|word2" and "word1 word2" easily. I will try to come up with a patch soon, inspired by the two patches of Stefano, if he won't beat me to it.
Comment 7 Robert Roth 2017-11-09 23:11:04 UTC
Created attachment 363316 [details] [review]
Support searching for multiple tokens (bgo#789905)
Comment 8 Robert Roth 2017-11-09 23:13:17 UTC
Here's my attempt to merge all what we have brainstormed so far: search by multiple patterns, separated by either " " or "|", internally with a regexp. Quick tests and a short review are appreciated.
Comment 9 Stefano Facchini 2017-11-10 08:10:06 UTC
Review of attachment 363316 [details] [review]:

Hi Robert,
maybe we could show a popup menu for the search entry (like Nautilus), with a check button to activate regex matching.
I'm worried that the approach of this patch is a bit too magical and could lead to unexpected results, for instance with the search text "foo(bar baz)"... I know, it's really a corner case :) but still something strange could happen.
Comment 10 Robert Roth 2017-11-10 11:05:26 UTC
I like the approach of gEdit, and I'm not sure which popup menu of nautilus you are talking about (I'm on 3.24.x still), I don't have regexp search in nautilus. But yes, options in a popup for toggling regexp search vs simple search, and match case. (a popup with a single entry for regexp would look strange).
Comment 11 Stefano Facchini 2017-11-10 11:28:07 UTC
I'm talking about the popover on the right of the search entry in Nautilus, where you can choose the date and file type -- no regexp of course :) it was just an example for search options. But the gedit menu is indeed a much better example!

But in the end it would be good to just accept the two forms "w1 w2 w3" and "w1|w2|w3", I was just concerned about implementing the former by replacing spaces by | and treating it as a regexp. But no big deal, maybe it's an overparanoid concern
Comment 12 Robert Roth 2018-02-03 08:26:29 UTC
Ok, for now (3.27 cycle) I did push it as the proposed patch does it : accept multiple tokens separated by ' ' or '|', using regexp internally, marking this as closed. We will see if there is a need for regexp-based searching, and in that case I will implement a gEdit-like popover for choosing search modes.

This problem has been fixed in the unstable development version. The fix will be available in the next major software release. You may need to upgrade your Linux distribution to obtain that newer version.