PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

[Run] Strings after "-" symbol are not showing up

Open 4k3or3et opened this issue 5 years ago • 11 comments

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

4k3or3et avatar May 20 '20 17:05 4k3or3et

Related to #3330

jyuwono avatar May 20 '20 17:05 jyuwono

tracking in #3330

crutkas avatar May 20 '20 17:05 crutkas

Thanks for filing, working on it!

crutkas avatar May 20 '20 17:05 crutkas

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.

androidSwDev099 avatar Jun 09 '20 17:06 androidSwDev099

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 ?

dsrivastavv avatar Jun 09 '20 23:06 dsrivastavv

Define “fast”. Let’s get numbers.

crutkas avatar Jun 10 '20 00:06 crutkas

@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

dsrivastavv avatar Jun 10 '20 18:06 dsrivastavv

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

crutkas avatar Jun 16 '20 19:06 crutkas

Someone please fix the title - Stings != Strings

androidSwDev099 avatar Jun 16 '20 20:06 androidSwDev099

pinged indexer team again

crutkas avatar Dec 10 '20 16:12 crutkas

Is this still an issue with the latest version?

Jay-o-Way avatar Sep 17 '22 13:09 Jay-o-Way

Has there been any progress on this? It had previously been classified as P0 - but there have been many releases since then.

All I can see on the link to the ADO bug is:

  • 401 - Uh-oh, you do not have access.

This is basic functionality that other tools of this kind get right (eg Wox/Search Everything).

brianbienvenu avatar Nov 23 '22 23:11 brianbienvenu