I've gobbled together a basic Powershell script to query W10's Windows Desktop Search (WDS) index. Here is the relevant bits,
$query = "
SELECT System.DateModified, System.ItemPathDisplay
FROM SystemIndex
WHERE CONTAINS(System.Search.Contents, '$($text)')
"
$objConnection = New-Object -ComObject adodb.connection
$objrecordset = New-Object -ComObject adodb.recordset
$objrecordset.CursorLocation = 3
$objconnection.open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';")
$objrecordset.open($query, $objConnection, $adOpenStatic)
Until now my tests have been using single words and everything works. But when I started using two words, it falls apart with the following error,
Searching for 'and then'...
SELECT System.DateModified, System.ItemPathDisplay
FROM SystemIndex
WHERE CONTAINS(System.Search.Contents, 'and then')
Exception from HRESULT: 0x80040E14
At D:\searchSystemIndex.ps1:72 char:1
+ $objrecordset.open($query, $objConnection, $adOpenStatic)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Using Explorer to query the index using content:"and then"
works fine.
Any ideas?