Home

Connection to Windows search?

edited February 16

How do I configure LINQPad to connect to Windows Search so I can use LINQ, SQL, and AQS? The connection string would be: Provider=Search.CollatorDSO;Extended Properties=\"Application=Windows\"

Comments

  • You could write a query like this:

    using (var connection = new OleDbConnection ("Provider=Search.CollatorDSO;Extended Properties=\"Application=Windows\""))
    {
        connection.Open();
        var cmd = connection.CreateCommand();
        cmd.CommandText = @"SELECT TOP 10 System.ItemPathDisplay, System.ItemUrl FROM SYSTEMINDEX WHERE System.ItemType = '.config'";
        cmd.ExecuteReader().Dump();   // LINQPad lets you Dump a DataReader
    }
    

    Be sure to add System.Data.OleDb to the Additional Namespace Imports property tab (Ctrl+Shift+M).

    Also note that in LINQPad 6 you will need to add a reference to the NuGet package System.Data.OleDb.

  • Thank you for your help.
    Since the Windows search index allows SQL syntax, can you make this a first class citizen in the next version of LINQPad, so we can enter Search queries into the SQL window? A separate AQS window would be even better!

Sign In or Register to comment.