PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

Searching exclusively for folders

Open qvattr0 opened this issue 7 months ago • 4 comments

Description of the new feature / enhancement

There's an extension in Command Palette that can be used to search for files. It would be useful to be able to configure the extension to search exclusively for folders instead of files or, ideally, be able to provide the extension with a flag which would make it search for folders only. It would be even more convenient if it would be possible if it was possible to, within extension settings, to configure a new alias (to be used along with the file alias for calling search) that would make search display only folders.

Scenario when this would be used?

A scenario in which this feature would be used is if, for instance, the user has a folder with a name foo and all the files inside had names starting with foo... accompanied by unique metadata specific to the file. The behavior of Command Palette I've noticed so far is that it displays (and selects) the first file in the folder before showing the folder itself even though the search is explicitly foo. As such, getting into the folder is tedious as you'd have to scroll through hundreds of files before actually getting to the folder.

qvattr0 avatar May 06 '25 06:05 qvattr0

Oh this is a really good use case for "filters". This is something that we spec'd up for Command Palette, but never got around to actually implementing yet.

Great suggestion!

zadjii-msft avatar May 07 '25 10:05 zadjii-msft

Does Command Palette weigh search results? As in, depending on how often you chose a certain search result, it'll be pushed closer to the top. Could be very powerful when combined with filters.

qvattr0 avatar May 07 '25 11:05 qvattr0

Yes and no:

  • Yes, the top level does do some very rudimentary frecency weighting. It's not perfect, but it does help.
    • though, for "fallbacks" like the Run / Web Search commands on the top level, it's not weighted per-result, just "run" itself gets all the weight (regardless of the command. The File Search fallback in 0.2 will work similarly
  • No, the file search page itself doesn't do any frecency weighting beyond whatever Indexer gives us. We probably could add that though. Just like how the Run page does remember your recent commands

zadjii-msft avatar May 07 '25 14:05 zadjii-msft

Going off qvattr0 idea, it would helpful if we can specify extention that we don't want to see in CmdPal search.

For example : If I am looking for a file named 'software' in my documents folders. Instead of getting all of windows sytems file like bat, reg. We just tell CmdPal not to show all the files that end with Bat name.

WatchTheory avatar Jul 07 '25 18:07 WatchTheory

Considering we respect limiters like type:folder or type:file I wonder if the filter for the indexer extension should just append those to the search text? That provides the functionality of limiting, while also educating the user.

@niels9001 / @zadjii-msft thoughts?

michaeljolley avatar Sep 02 '25 21:09 michaeljolley

Considering we respect limiters like type:folder or type:file I wonder if the filter for the indexer extension should just append those to the search text? That provides the functionality of limiting, while also educating the user.

@niels9001 / @zadjii-msft thoughts?

@michaeljolley Do you have an example of what that'd look like?

niels9001 avatar Sep 02 '25 21:09 niels9001

@michaeljolley Do you have an example of what that'd look like?

No, but I imagine you're either clicking on the filter or it has focus and you're using a keyboard. So the search box doesn't have focus. I propose if you activate a filter here, we just append to the search text that exists type: filter or whatever. That would trigger a refresh of the list, and the newly added limiter would be respected.

michaeljolley avatar Sep 02 '25 22:09 michaeljolley

@michaeljolley If you update the SearchText on DynamicListPage (the base class for IndexerPage), be aware that since commit e0a0bbffe527f46e7fd9f3b815c686c66e03325d that property no longer raises change notifications. It bit me the other day.

jiripolasek avatar Sep 16 '25 19:09 jiripolasek