Windows搜索 – 全文搜索c#

我正在寻找一个使用Windows搜索获得全文搜索结果代码(认情况下应该在Vista,7和8中可用)。

在这里找到了一些问题和一些关于msdn的文本,但没有一个有一些确切的代码。我已经尝试使用Windows API代码包(因为它被提及为Windows搜索的接口之一),但它只返回结果文件名,而不是全文。

这是代码,它的工作 – 例如我使它在桌面文件夹中搜索单词“dummy”:
string connectionString = "Provider=Search.CollatorDSO;Extended Properties=\"Application=Windows\"";
OleDbConnection connection = new OleDbConnection(connectionString);

string query = @"SELECT System.ItemName FROM SystemIndex " +
   @"WHERE scope ='file:" + System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "' and FREETEXT('dummy')";
OleDbCommand command = new OleDbCommand(query,connection);
connection.open();

List<string> result = new List<string>();

OleDbDataReader reader = command.ExecuteReader();
while (reader.Read())
{
    result.Add(reader.GetString(0));
}

connection.Close();

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...