Powertoys: PT Run. strings after "-" symbol are not showing up...

Created on 20 May 2020  ·  9Comments  ·  Source: microsoft/PowerToys

Hi All

I am pretty sure there is an error with search result with stings which are just after "-" symbol...

Let's say i have a file:

abc_123-def_456.mp3

So when you type 'def' nothing found. However when you type '456' it finds the file.

I tested that with multiple files.

PowerToys update [crutkas edited]:
We are currently blocked on resolving this since it a bug in Indexer regarding word breaks. For PowerToys to use the LIKE statement as a workaround, we feel the speed difference is too costly and is a constant impact for all queries, not just files with a dash in them.

Tracking ADO bug is: https://microsoft.visualstudio.com/OS/_workitems/edit/25828850

Issue-Bug Product-Launcher Status-Blocked

Most helpful comment

Someone please fix the title - Stings != Strings

All 9 comments

Related to #3330

tracking in #3330

Thanks for filing, working on it!

Hi All

I am pretty sure there is an error with search result with stings which are just after "-" symbol...

Let's say i have a file:

abc_123-def_456.mp3

So when you type 'def' nothing found. However when you type '456' it finds the file.

I tested that with multiple files.

Until they fix it, you can search "*def" and find your file if that helps.

Query 1

def transform to following SQL query :
SELECT TOP 100 "System.ItemUrl", "System.FileName" FROM "SystemIndex" WHERE CONTAINS(System.FileName,'"def*"',1033) AND scope='file:' ORDER BY System.DateModified DESC

This query will match all the words starting with def. Note in SQL space, _ are both considered as word breakers. So the above query will match "here define" or "abc_def"" but will not match "abc-def" as - is not a word breaker.

Query 2

*def transforms to following SQL Query : SELECT TOP 100 "System.ItemUrl", "System.FileName" FROM "SystemIndex" WHERE (System.FileName LIKE '%def%' OR CONTAINS(System.FileName,'"*def*"',1033)) AND scope='file:' ORDER BY System.DateModified DESC.

In this query, we are using LIKE statement which matches all strings containing substring def. Hence "abc-def" will be a match.

Performance Issue

The first SQL is faster because it can use an inbuilt index on System.FileName. The second query, using LIKE, will be unable to use an index since it starts with a wildcard, so it will always require a full table scan.

So if we try to modify the current behavior and do a substring match using LIKE it will heavily impact the performance of indexer plugin. Also, the start menu has similar behavior.

The best we could do here is to add - as a word breaker.
@ryanbodrug-microsoft @crutkas What do you suggest ?

Define “fast”. Let’s get numbers.

@crutkas @ryanbodrug-microsoft

I ran index search on 40 randomly picked filenames.

Stats for query with LIKE SQL statement in ms
Mean :226.9
Min :100
Max :956

Stats for query without LIKE SQL statement in ms
Mean :47.9
Min :31
Max :101

Added update at top but for people watching:

We are currently blocked on resolving this since it a bug in Indexer regarding word breaks. For PowerToys to use the LIKE statement as a workaround, we feel the speed difference is too costly and is a constant impact for all queries, not just files with a dash in them.

Tracking ADO bug is: https://microsoft.visualstudio.com/OS/_workitems/edit/25828850

Someone please fix the title - Stings != Strings

Was this page helpful?
0 / 5 - 0 ratings

Related issues

crutkas picture crutkas  ·  48Comments

Dr-Flay picture Dr-Flay  ·  45Comments

MarcGervais picture MarcGervais  ·  55Comments

crutkas picture crutkas  ·  54Comments

ET3117 picture ET3117  ·  43Comments