Return first result without subfolder

Discussion related to "Everything" 1.5.
Post Reply
0xDEADC0DE
Posts: 22
Joined: Mon Jun 29, 2020 9:00 am

Return first result without subfolder

Post by 0xDEADC0DE »

D:\abc123
D:\abc123\abc123-xxxx
D:\abc123\abc123-yyyy
D:\bbc123
D:\bbc123\bbc123-xxxx
D:\bbc123\bbc123-yyyy
D:\x\bbc123\bbc123-xxxx

when I search for bc12, I only want the first folder returned without subfolders.

Code: Select all

abc123       D:\abc123
bbc123       D:\bbc123
bbc123       D:\x\bbc123
I've tried a lot of modifiers but nothing worked.
Is this even possible?
void
Developer
Posts: 19870
Joined: Fri Oct 16, 2009 11:31 pm

Re: Return first result without subfolder

Post by void »

Match bc12 in the name, but not in the path part:

name:bc12 !pathpart:bc12
0xDEADC0DE
Posts: 22
Joined: Mon Jun 29, 2020 9:00 am

Re: Return first result without subfolder

Post by 0xDEADC0DE »

Amazing. Thanks.
Is there a solution without repeating the search string?
Like
bc1 !pathpart:<searchstring>

bc1 bc2 !pathpart:<searchstring>
should expand to
bc1 bc2 !pathpart:bc1 !pathpart:bc2

In my real example, I have many folders with
Star Trek DS9
Star Trek Voyager
Star Trek Prodigy
...

I cannot search for prodigy alone as this returns many other folders.
So I have to search for
star trek prodigy !pathpart:star !pathpart:trek !pathpart:prodigy
void
Developer
Posts: 19870
Joined: Fri Oct 16, 2009 11:31 pm

Re: Return first result without subfolder

Post by void »

Please consider a First Result Without Subfolder filter:
  • In Everything, from the Search menu, click Add to filters....
  • Change the Name to: First Result Without Subfolder
  • Change the Search to:
    name:$param: !pathpart:$param:
  • Change the Macro to:
    fr
  • Click OK.
Now when you search for
fr:bc1
the search is replaced with
name:bc1 !pathpart:bc1


fr:bc1 fr:bc2
is replaced with
name:bc1 !pathpart:bc1 name:bc2 !pathpart:bc2


fr:<bc1 bc2>
is replaced with
name:<bc1 bc2> !pathpart:<bc1 bc2>
0xDEADC0DE
Posts: 22
Joined: Mon Jun 29, 2020 9:00 am

Re: Return first result without subfolder

Post by 0xDEADC0DE »

That's great. Much better than expected.
8-)
Post Reply