Search filter to search for a content

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
vsub
Posts: 339
Joined: Sat Nov 12, 2011 11:51 am

Search filter to search for a content

Post by vsub » Sun May 09, 2021 4:37 pm

Can I make a filter that searches inside the files(ahk)which are located in a specific folder so when I select that filter,it will automatically display all of the ahk files in that folder and when i start typing,it will do a content search in that folder only on the ahk files

NotNull
Posts: 3047
Joined: Wed May 24, 2017 9:22 pm

Re: Search filter to search for a content

Post by NotNull » Sun May 09, 2021 8:09 pm

With limitations, but possible.

Create a filter with

Code: Select all

Name   = ahktext
Search = "c:\some folder"   ext:ahk   utf8content:"QUERY:
Macro  = <QUERY> 
With that, and the ahktext filter enabled, you can search for
the quick brown fox
to find all ahk files in c:\some folder that contain that specific text string.
The limitation: you can specify just one search string.
the quick brown fox dog
will not find the quick brown fox jumps over the lazy dog.

There might be better ways, but I can't think of any at the moment.

vsub
Posts: 339
Joined: Sat Nov 12, 2011 11:51 am

Re: Search filter to search for a content

Post by vsub » Sun May 16, 2021 8:09 am

Sorry for the late reply but either I am not doing it properly or it does not work

1.Create a new filter with a name AHK
2.On "Search" I type "my ahk folder" ext:ahk utf8content:
3.Hit ok
4.Switch to that AHK filter and type ffmpeg
Everything shows only one file and that file is the only file named ffmpeg
It also does not work if I set a macro and use it while the active filter is "Everything"

If I switch to the Everything filter that shows everything and type "my ahk folder" ext:ahk utf8content:ffmpeg,I get 6 results

Even if I set for search in the filter ext:ahk content:,it will still act as if I am searching for file names,not content
And if I create a bookmark and set a macro and use the macro for my search,it will also act as if I am searching for file names

Maybe a bug or non implemented feature(content search file using a filter or a macro that contains that content searching function)

To put it simply
ext:ahk content: in a filter don't do content searching
ext:ahk content: in a filter with macro and use the macro,same
ext:ahk content: in a bookmark with a macro and use the macro,same
Search normally by typing ext:ahk content:ffmpeg,displays all files that contains that word

NotNull
Posts: 3047
Joined: Wed May 24, 2017 9:22 pm

Re: Search filter to search for a content

Post by NotNull » Sun May 16, 2021 6:15 pm

Try it with:

Code: Select all

Name   = AHK
Search = "my ahk folder"   ext:ahk   utf8content:"QUERY:
Macro  = <QUERY> 
(replace "my ahk folder" with the actual folder. Leave the rest as-is)


Enable the AHK filter and search for:
ffmpeg

vsub
Posts: 339
Joined: Sat Nov 12, 2011 11:51 am

Re: Search filter to search for a content

Post by vsub » Sun May 16, 2021 7:04 pm

I did not add that macro the last time because I didn't think it was needed
Why does adding the macro makes it work?
Isn't the macro just a shortcut to make Everything use the search criteria when you type it?
And why do I need just one quotas

It works now,thanks

NotNull
Posts: 3047
Joined: Wed May 24, 2017 9:22 pm

Re: Search filter to search for a content

Post by NotNull » Sun May 16, 2021 7:40 pm

vsub wrote:
Sun May 16, 2021 7:04 pm
I did not add that macro the last time because I didn't think it was needed
Why does adding the macro makes it work?
Isn't the macro just a shortcut to make Everything use the search criteria when you type it?
And why do I need just one quotas

It works now,thanks
Everything needs the QUERY in both places so it understands that QUERY is a variable that will be replaced with what you type, not some literal text to search for.
(BTW: QUERY is chosen at random; you could replace "QUERY" with for example "something" or "%1" to get the same effect).

Typically you would define the macro as ahk<QUERY>, so that you could also search for
ahk:ffmpeg
, without the need to enable the filter. But as you don't need that, I left it out.


The " is needed for search strings that contain more than one word. Default, a space breaks the content: search and will see the spcae as an AND operator, causing whatever you type after that space to match filenames again.

You can see the effect of the " when you do a normal - Everything filter enabled, no search options - search for
program fi
vs.
"program fi
.
Because Everything is search-as-you-type, Everything will assume the closing " will come later and implicitly puts it at after the last character you typed. At least, that is my theory; havn't seen the source code :)

vsub
Posts: 339
Joined: Sat Nov 12, 2011 11:51 am

Re: Search filter to search for a content

Post by vsub » Sun May 16, 2021 8:05 pm

Ok thanks for the info

oO0XX0Oo
Posts: 6
Joined: Sun Dec 09, 2018 3:44 pm

Re: Search filter to search for a content

Post by oO0XX0Oo » Thu Jun 10, 2021 7:39 am

@NotNull
Typically you would define the macro as ahk<QUERY>, so that you could also search for
ahk:ffmpeg
, without the need to enable the filter. But as you don't need that, I left it out.
So something like this should work (while "Menu - Search - Everything" is still checked)?

Code: Select all

Name: AutoHotkey
Search: "D:\AutoHotkey" ext:ahk content:"QUERY:
Macro: ahk<QUERY>
and then in the search line of Everything:
ahk:copydata


If yes, it doesn't work...
While this:
"D:\AutoHotkey" ext:ahk content:copydata

does work fine

Running the latest v1.5 alpha...

NotNull
Posts: 3047
Joined: Wed May 24, 2017 9:22 pm

Re: Search filter to search for a content

Post by NotNull » Thu Jun 10, 2021 12:28 pm

oO0XX0Oo wrote:
Thu Jun 10, 2021 7:39 am
If yes, it doesn't work...
Unfortunately, the answer to that question is No.
Behind the scenes, in Everything's engine room that search is translated to

Code: Select all

nofiltercase:nofilterpath:nofilterwholeword:nofilterdiacritics:nofilterprefix:nofiltersuffix:nofilterignorepunctuation:nofilterignorewhitespace:nofilterregex:< "c:\develop" ext:ahk  content:"copydata >
and that doesn't like the missing closing "

When you want to use ahk:copydata, you need a different approach:

Code: Select all

Name: AutoHotkey
Search: "D:\AutoHotkey" ext:ahk content:QUERY:
Macro: ahk<QUERY>
The only difference being the missing " in the search definition.

Where the first solution can search for a string containing multiple words, this solution searches for strings containing a single word (=no space character).
So now you can use: ahk:copydata
When you want to search for a string containing a space or a |, enclose the string in quotes, like: ahk:"copydata, A_PtrSize"

oO0XX0Oo
Posts: 6
Joined: Sun Dec 09, 2018 3:44 pm

Re: Search filter to search for a content

Post by oO0XX0Oo » Thu Jun 10, 2021 6:48 pm

Thanks, NotNull!

That works as expected :mrgreen:

Post Reply