我正在尝试使用 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)的列的链接:
似乎 System.Search.QueryFocusedSummary
没有公开,而 System.Search.AutoSummary
是。也许这就是您无法获得专栏的原因。
关于c# - Windows Search sql - 无法访问 System.Search.QueryFocusedSummary,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6071766/