0

I have an odd problem with Windows Search engine. When I search for the Greek word, Όρος, in the Windows 10 Start menu search bar, I get the expected results.

When I search via VB.Net it fails to find any results. I've narrowed the issue to the final letter 'ς'. Removing it allows the search to succeed. Anyone know what the problem could be?

Dim t As String
t = UCase("Όρο")   ' success
't = UCase("Όρος")  ' fails

Dim connection = New OleDbConnection("Provider=Search.CollatorDSO;Extended Properties=""Application=Windows""")

Dim query1 = "SELECT System.ItemName FROM SystemIndex " +
    "WHERE System.ItemName LIKE '%" & t & "%'"

connection.Open()

Dim Command = New OleDbCommand(query1, connection)

Dim r

Try
    r = Command.ExecuteReader
Catch
    Debug.WriteLine("Search failed!")
    Return
End Try

Dim c = 0

While (r.Read())
    c += 1
    Debug.WriteLine(r(0))
End While
Debug.WriteLine("Total:" & c)
GSerg
  • 76,472
  • 17
  • 159
  • 346
Dude named Ben
  • 507
  • 3
  • 16
  • 1
    You really ought to always be using parameters with ADO.NET anyway but, while it's a guess, I wonder whether that might be the problem here. Try using a parameter to insert the value into your SQL and specify the data type as `OleDbType.VarWChar`. – jmcilhinney Aug 09 '20 at 05:42

1 Answers1

0

So it appears to be a bug in the library as far as I can tell.

After googling around, found the following related article,

https://channel9.msdn.com/coding4fun/articles/Searching-the-Desktop

which searched System.ItemNameDisplay instead of System.ItemName

Updated my query to use alternate field and it works.

Dude named Ben
  • 507
  • 3
  • 16