c# - Windows Search sql - 无法访问 System.Search.QueryFocusedSummary

标签 c# interop

我正在尝试使用 sql 查询 Windows Search 4.0。该属性(property) 我感兴趣的是:System.Search.QueryFocusedSummary

我正在尝试从 SystemIndex 中读取此属性。我收到“列不存在”错误消息。我能够阅读其他列,例如:System.Search.AutoSummary

我正在使用 Microsoft Windows Search 3.x SDK 下载 (Windows.Search.Interop.dll) 在 Windows 7 操作系统和 Windows 搜索 4.0。

我的查询是:
SELECT TOP 25 System.QueryFocusedSummary 来自 SystemIndex 其中 CONTAINS('microsoft') ORDER BY System.ItemDate DESC

如何使用 System.Search.QueryFocusedSummary 获取查询?

代码如下:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Security.Permissions;
using System.Text;
using Microsoft.Search.Interop;

namespace QueryFocusedSummaryTest
{
    class Program
    [Stathread]
    static void Main(string[] args)
    {
        string sqlQuery = "select top 25 System.Search.QueryFocusedSummary from SystemIndex where contains('microsoft') order by System.ItemDate DESC";

        CSearchManager manager = new CSearchManager();
        ISearchCtalogManager catalogMaager = manager.GetCatalog("SystemIndex");
        ISearchQueryHelper queryHelper = catalogManager.GetQueryHelper();

        using (System.Data.OleDb.OleDbConnection conn = new OleDbConnection(queryHelper.ConnectionString))
        {
            conn.Open();

            using (OleDbCommand command = new OleDbCommand(sqlQuery, conn))
            {
                OleDbDataAdapter ds = new OleDbDataAdapter(command);
                DataSet ds = new DataSet();
                ds.Fill(ds);
                command.ExecuteNonQuery();
                //By now it has thrown the exception saying that the column is not found.
            }
        }
    }
} 

最佳答案

这里是关于可用于 oledb 接口(interface)的列的链接:

https://web.archive.org/web/20120615190325/http://www.ariankulp.com/downloads/WindowsShellOLEProperties.txt

似乎 System.Search.QueryFocusedSummary 没有公开,而 System.Search.AutoSummary 是。也许这就是您无法获得专栏的原因。

关于c# - Windows Search sql - 无法访问 System.Search.QueryFocusedSummary,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6071766/

相关文章:

c# - 使用异步等待的并行多线程下载

c# - .NET 正则表达式替换单行匹配未知字符

c - Fortran 在两个 C 函数之间传递 C 结构

.net - 当互操作程序集嵌入到 .NET 4.0 中时,Excel get_Range 丢失

c# - 如何为我的 C# 项目支持 Linux

c# - 将参数替换为表达式

c# linq nested "conditional/composite"分组

c# - 相同的代码,C# 和 C++ 中的不同输出

c++ - C# 与非托管 C++ 互操作性的续篇

c# - 在 C# 中管理 COM 对象