Is there a way to call SearchIndexer with arguments? (or is there another way to accomplish what the title says?)
I tried looking at the various MSDN articles, but they all seemed to suggest that I use a library. But when I run the search, it runs, without me downloading any sort of library.
Back in the days of XP, you could go to the indexing service properties and execute a query. I don’t see that in Windows 7.
Thanks.
Here’s an example query. Note that it does not use the Windows 7 SDK.
However, it was adapted from the DSearch example in the Windows 7 SDK. ([SDK]\Samples\winui\WindowsSearch\DSearch. [SDK] is typically “C:\Program Files\Microsoft SDKs\Windows\v7.1”
Note that you can make the SQL query more easily (but slightly less flexible imo) if you use the SDK’s
ISearchQueryHelper. To use that class and related classes though, you need have reference toMicrosoft.Search.Interop, which is not included in the Windows 7 SDK as a dll. You can however get it in dll form by using TlbImp.exe (type library importer, in [SDK]\bin) on the SearchAPI.tlb file (in [SDK]\Lib). Also described here.I hope this post helps anyone else who needs to programmatically connect to the Windows Search in Windows 7 or higher.