Filter functions
Filter functions
A filter function is a special filter macro that takes one parameter that can dynamically build a filter search.
Filter functions have been added to Everything 1.4.1.790b:
http://www.voidtools.com/Everything-1.4.1.790b.x86.zip
http://www.voidtools.com/Everything-1.4.1.790b.x64.zip
To create a filter function, append the filter macro name with:
<name>
All occurrences of name: in the filters search will be substituted with the parameter passed to your macro.
For example, to search for files with the content "foo bar", where the files could be utf8 or ansi, you would have to search for:
utf8content:"foo bar" | ansicontent:"foo bar"
With filter functions, you can create a filter (from Search -> Add to filters...) with the macro:
ct<search>
and with the filter search:
utf8content:search: | ansicontent:search:
when searching for ct:"foo bar" the search will be replaced with:
utf8content:"foo bar" | ansicontent:"foo bar"
Filter functions have been added to Everything 1.4.1.790b:
http://www.voidtools.com/Everything-1.4.1.790b.x86.zip
http://www.voidtools.com/Everything-1.4.1.790b.x64.zip
To create a filter function, append the filter macro name with:
<name>
All occurrences of name: in the filters search will be substituted with the parameter passed to your macro.
For example, to search for files with the content "foo bar", where the files could be utf8 or ansi, you would have to search for:
utf8content:"foo bar" | ansicontent:"foo bar"
With filter functions, you can create a filter (from Search -> Add to filters...) with the macro:
ct<search>
and with the filter search:
utf8content:search: | ansicontent:search:
when searching for ct:"foo bar" the search will be replaced with:
utf8content:"foo bar" | ansicontent:"foo bar"
Re: Filter functions
This is an excellent and powerful new feature! For example, I am now able to create a custom Whole Word filter that includes the underscore character as a word boundary, something I've long missed in Everything. I set up the Filter like this:
Thank you!
Code: Select all
Search: regex:"(?:\b|_)word:(?:\b|_)"
Macro: ww<word>
Re: Filter functions
I'm probably being dense, I don't quite get it....is it possible to put a screenshot up with an example?
Re: Filter functions
The search is now used as the filter parameter when a filter with a macro function is active in Everything 795b:
http://www.voidtools.com/Everything-1.4.1.795b.x86.zip
http://www.voidtools.com/Everything-1.4.1.795b.x64.zip
For example, if you have the filter with the search:
parent:search:
and the macro:
myparent<search>
When this filter is active, the search: part is substituted with the current search.
So when searching for c:\windows with the parent filter active, the search is replaced with:
parent:c:\windows
http://www.voidtools.com/Everything-1.4.1.795b.x86.zip
http://www.voidtools.com/Everything-1.4.1.795b.x64.zip
For example, if you have the filter with the search:
parent:search:
and the macro:
myparent<search>
When this filter is active, the search: part is substituted with the current search.
So when searching for c:\windows with the parent filter active, the search is replaced with:
parent:c:\windows
-
- Posts: 7
- Joined: Mon Oct 09, 2017 9:30 am
Re: Filter functions
I'm sure this is extremely powerful and even "simple", but sadly it's not accessible to the "ordinary people" who never write a line of code and are used to intuitive UIs with cells to be filled in.
Re: Filter functions
There is no code to write and the examples above are easy to follow even for beginners.hansolocambo wrote:I'm sure this is extremely powerful and even "simple", but sadly it's not accessible to the "ordinary people" who never write a line of code and are used to intuitive UIs with cells to be filled in.
If that is to much you should probably stay with Windows search or only use the basic Everything features.
Re: Filter functions
I don't think so.There is no code to write and the examples above are easy to follow even for beginners.
Anyway,
<search>
search:
This Syntax where was it taken from? What was its inspiration?
-
- Posts: 7
- Joined: Mon Oct 09, 2017 9:30 am
Re: Filter functions
If the most helpful things that come to your mind look like this, keep it to yourself.
Re: Filter functions
You said you want "intuitive UIs with cells to be filled in"hansolocambo wrote: ↑Fri May 24, 2019 11:26 amIf the most helpful things that come to your mind look like this, keep it to yourself.
So if that is not available use the basic features of Everything or some other fancy GUI based tool.
For most "simple" usage its all you need.
And I still will comment
Re: Filter functions
Maybe this helps.hansolocambo wrote: ↑Mon Oct 09, 2017 9:35 am I'm sure this is extremely powerful and even "simple", but sadly it's not accessible to the "ordinary people" who never write a line of code and are used to intuitive UIs with cells to be filled in.
How to create and use you own filter functions
First we can ask: Why use a filter function? What's the point? Answer: use it to simplify a complex search that you do regularly but that Everything doesn't already have any simple menu option or short macro for.
Example where you don't need to create a filter function.
Everything already has the built in filter Compressed to search for compressed files. So if you type zip:food Everything lists files that are compressed (files with the extensions .zip .7z .rar ...) and has food in the filename. In this example zip: is the built-in macro for the filter. You type the macro to tell Everything what filter to apply.
Example where it can help to make a filter function
Imagine you regularly want to do some searches that apply several wildcards, functions and/or modifiers.
(See https://www.voidtools.com/support/everything/searching for built in search syntax.)
For example imagine that you regularly want to search for files in the folder C:\Windows or its subfolders with file extension .txt or .log
To do that first enable Match Path in the Search menu and then type C:\Windows ext:txt;log test
On my computer I get these results
(To see the screenshots either log in to voidtools forum or view them on imgur here https://imgur.com/a/vZT4ELm )
A filter function can do the same search with less typing.
To create a filter function go to Search > Organize Filter... > New
The New Filter window is now shown. Enter the details shown in this screenshot and press OK.
Now type win:test in Everything to use the filter we created.
The results are the same as before
What happens is that Everything behind the scenes transformed win: into C:\Windows ext:txt;log
Three important things to remember when you make filter functions
1. win (blue color in the screenshot). This is the custom macro name. We later type win: in Everything to use the macro. Note that there should be no colon when we create the filter (no colon in the blue part), but a colon when we use the filter.
2. <search> (green color) represents any string the user types after win:
3. search: (red color) also represents any string the user types after win:
Question: why <search> in one field and search: in the other? Answer: I don't know, but that's the way it has to be.
To make your own filter functions use my example above but change the blue and pink parts. Examples:
- Change the blue text to xyz and you can later in Everything type xyz: to search with the filter function. For example xyz:test
- Change the pink text to D:\ ext:txt size:<25000 search: to make a filter that searches for files on drive D:\ with extension .txt and a size smaller than 25000 bytes.
- See https://www.voidtools.com/support/everything/searching for all the built in search command you can combine when you make a filter function.
Filter functions without macros
You don't have to use macros. You can instead toggle the filter function on/off in the Search menu or through a hotkey that you set up in the Add Filter window.
Re: Filter functions
@nod5, very nice.
I still think there is something to improve here.
I liked the most this sentence:
I had a discussion once about such:
Syntax of functions
I still think there is something to improve here.
I liked the most this sentence:
How to produce a clear syntax without causing confusion (like avoid using signs with double meaning and so), is a work of art.
I had a discussion once about such:
Syntax of functions
Re: Filter functions
To improve the syntax I think the placeholder in the 2 fields should have the same characters:
utf8content:search: | ansicontent:search:
ct<search>
Search: regex:"(?:\b|_)word:(?:\b|_)"
Macro: ww<word>
parent:search:
myparent<search>
According to the new suggestion:
utf8content:<<>> | ansicontent:<<>>
ct:<<>>
Search: regex:"(?:\b|_)<<>>(?:\b|_)"
Macro: ww:<<>>
parent:<<>>
myparent:<<>>
(macro and macro: will be the same)
(myparent and myparent: will be the same)
This is also good:
parent:<search>
myparent:<search>
parent:search:
myparent:search:
utf8content:search: | ansicontent:search:
ct<search>
Search: regex:"(?:\b|_)word:(?:\b|_)"
Macro: ww<word>
parent:search:
myparent<search>
According to the new suggestion:
utf8content:<<>> | ansicontent:<<>>
ct:<<>>
Search: regex:"(?:\b|_)<<>>(?:\b|_)"
Macro: ww:<<>>
parent:<<>>
myparent:<<>>
(macro and macro: will be the same)
(myparent and myparent: will be the same)
This is also good:
parent:<search>
myparent:<search>
parent:search:
myparent:search:
Re: Filter functions
I have put on my TODO list to improve the filter macro syntax.
Ideally, you shouldn't have to define the parameter name in the macro field.
I should add a hard-coded parameter name for the search field.
Maybe something like <<>> or [param:]
eg:
search: parent:[param:]
macro: myparent
Thanks for the suggestions.
Ideally, you shouldn't have to define the parameter name in the macro field.
I should add a hard-coded parameter name for the search field.
Maybe something like <<>> or [param:]
eg:
search: parent:[param:]
macro: myparent
Thanks for the suggestions.
Re: Filter functions
Everything 1.5.0.1355a improves macros.
Macro names no longer need to specify a parameter.
The parameter passed to a macro can now be reference in the search with $param:
The old macro-name<param> style syntax will still be supported.
Example filter:
Name: My uppercase filter
Search: case:[upper:$param:]
Macro: up
Example usage:
up:abc
=> case:ABC
Only one parameter is now supported.
Multiple parameter filter example:
Name: Width and Height
Search: width:[element:$param:,",",1] height:[element:$param:,",",2]
Macro: wh
Example usage:
wh:800,600
=> width:800 height:600
Macro names no longer need to specify a parameter.
The parameter passed to a macro can now be reference in the search with $param:
The old macro-name<param> style syntax will still be supported.
Example filter:
Name: My uppercase filter
Search: case:[upper:$param:]
Macro: up
Example usage:
up:abc
=> case:ABC
Only one parameter is now supported.
Multiple parameter filter example:
Name: Width and Height
Search: width:[element:$param:,",",1] height:[element:$param:,",",2]
Macro: wh
Example usage:
wh:800,600
=> width:800 height:600