GNOME Bugzilla – Bug 789905
Match any of the words in the search box
Last modified: 2018-02-03 08:26:29 UTC
If I enter "polari nautilus" in the search box, I'd like to see polari and nautilus in the list, instead of nothing.
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.
Hello Stefano, nice patch, but maybe we could simply accept regex syntax instead ?
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 :)
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.
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.
(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.
Created attachment 363316 [details] [review] Support searching for multiple tokens (bgo#789905)
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.
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.
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).
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
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.