vb.netwindows-searchwds

Windows Search fails to find file when text converted to uppercase


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)

Solution

  • 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.