microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.11k stars 6.54k forks source link

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

Open 4k3or3et opened 4 years ago

4k3or3et commented 4 years ago

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

jyuwono commented 4 years ago

Related to #3330

crutkas commented 4 years ago

tracking in #3330

crutkas commented 4 years ago

Thanks for filing, working on it!

androidSwDev099 commented 4 years ago

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.

dsrivastavv commented 4 years ago

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 ?

crutkas commented 4 years ago

Define “fast”. Let’s get numbers.

dsrivastavv commented 4 years ago

@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

crutkas commented 4 years ago

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

androidSwDev099 commented 4 years ago

Someone please fix the title - Stings != Strings

crutkas commented 3 years ago

pinged indexer team again

Jay-o-Way commented 2 years ago

Is this still an issue with the latest version?

brianbienvenu commented 1 year ago

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:

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