-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance search operator #3502
Enhance search operator #3502
Conversation
and also searching all fields except nominated fields.
Hi @Jermolene, Well, this proposal doesn't seem too controversial :-) I find it quite elegant myself, but I wish it could also produce several outputs when the search leads to several matches. For instance, I'd like to obtain the following list Still, in order to build a more ubiquitous YouTube dropper, I'd also need to take in account the multiple variants of a YouTube video url, depending on whether the host name is youtube.com or youtu.be, whether the video is part of a playlist like in https://www.youtube.com/watch?v=FMCBlWgcrGc&index=3&list=PLJXb5DyfMUF7UwlTeFqIuiCLz4wHanAdt&t=390, with or without a starting time, etc. Such aim leads to monster regexps like |
Hi @xcazin
I think that this sort of thing needs a full-blown widget that sets variables to the results of a match:
We might also support attributes for specifying different variable names for the various outputs ( |
If you're doing that, shouldn't there be a |
Hi @Marxsal If you're doing that, shouldn't there be a Yes to the first, and I added a comment in |
* Enhance search operator * Add support for searching all fields and also searching all fields except nominated fields. * Docs tweaks Thanks @pmario * Error message improvements * Improve error message formatting
@Jermolene - first, thanks for your input on this matter. It seems a few of us don't fully understand the reasons why a widget is preferable over a filter op on this matter. For example, the snip you quote from @xcazin is:
...but this output is trivial to get - if using two separate filterings. Is that ("two") the problem? (BTW, with #4452 it'd be one). Or is your reasoning perhaps about @xcazin 's observation that:
...but a widget would not simplify this aspect, or? Also, other than the effort to construct it, would it be inappropriate with both filter ops and a widget? As I note in #4479 , string manipulation does "feel" like a filter operator matter. Thanks. |
It's fair that regexp feels like a filter operator matter but at the moment the limitations of filter operators make that difficult. In particular, a filter operator is able to return a list of results but a regular expression operation yields a match string, a list of captured groups, and a numeric position for the match, all of which can be useful. We could jam all of that information into a single list but it the filter code to manipulate it would become very clumsy and inscrutable. |
It is proposed to enhance the search operator:
For example:
The extended syntax for operator suffixes has been implemented in a manner that allows other filter operators to opt in to using it if they want to. We should review carefully whether the proposed format will be adequate for other operators that we may want to extend.
These changes are backwards compatible as long as existing wikis are not using the search operator with fields whose names contain colons or commas.
We could extend the advanced search box to allow the new search options to be used but I'm concerned that it might be overkill for most users while adding a lot to the core, and so might be best in a plugin.