lin-ycv / EverythingPowerToys

Everything search plugin for PowerToys Run
Eclipse Public License 2.0
2.2k stars 57 forks source link

Disable Match Path with exact: searches #120

Closed mike406 closed 2 months ago

mike406 commented 2 months ago

For issue https://github.com/lin-ycv/EverythingPowerToys/issues/117

mike406 commented 2 months ago

Amended PR with commit 7978d45 so that MatchPath isn't sent to debug log when an exact: search contains quotes.

lin-ycv commented 2 months ago

Nice catch. But I think I'd prefer to fix this by removing the feature where quotation marks sets path matching

cause according to everything docs, all of the following does the same thing:

wfn:
wholefilename:
nowfn:
nowholefilename:
exact:

And quotation marks can also use used to do exact search when using other modifiers

Or maybe something like " sets patch matching, but :” doesn't. (Needs to also check how the affects when regex is enabled)

@mike406 your thoughts on this?

Ref: https://www.voidtools.com/support/everything/searching/

mike406 commented 2 months ago

So it's tricky, I found that quotations are not the only issue so we can't disable the Match Path setting for them alone. If you enable Match Path in the plugin settings it creates the opposite issue, exact: matches without quotation marks will no longer show up. So maybe what we need to do is create an array of ["wfn:", "wholefilename:", "nowfn:", "nowholefilename:", "exact:"] and omit all of them from using Match Path.

Example below, here you can see me doing an exact search without quotations and it still is affected by Match Path image

image

mike406 commented 2 months ago

My C# is not great but given the above findings with Match Path something like this appears to work: https://github.com/lin-ycv/EverythingPowerToys/pull/120/commits/1c6296f584ab7756e8a02f12d755021b995dbe3d

It's tricky to account for all variations, and even still I am not fully confident this will work for every possible use case. I await your thoughts on this. Also once we have determined a fix that works, feel free to close this PR due to the messy commit history or however you would prefer to go about it.

Edit: I'm now seeing that nowfn/nowholefilename CAN work with Match Path and gives different results so maybe we should not omit those two? Maybe we just should restrict to string[] matchPathIgnoreList = ["wfn:", "wholefilename:", "exact:"];. Unsure...I'm going to try with just those ignored for a bit and see how it goes.

lin-ycv commented 2 months ago

so after some testing, the easiest fix is to simply remove the feature where " triggers path matching this feature wasn't even actually needed, everything already had a similar feature using \ image