Windows Search sql - can't access System.Search.QueryFocusedSummary

断了今生、忘了曾经 提交于 2019-12-23 09:33:43

问题


I'm trying to query the Windows Search 4.0 using sql. The property of interest for me is: System.Search.QueryFocusedSummary.

I'm trying to read this property from the SystemIndex. I get a "column does not exist" error message. I am able to read other columns such as: System.Search.AutoSummary.

I am using the Microsoft Windows Search 3.x SDK download (Windows.Search.Interop.dll) on a Windows 7 operating System and Windows Search 4.0.

My query is:
SELECT TOP 25 System.QueryFocusedSummary From SystemIndex where CONTAINS('microsoft') ORDER BY System.ItemDate DESC

How can I get the query working with System.Search.QueryFocusedSummary?

The code is as follows:

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.
            }
        }
    }
} 

回答1:


Here is a link about columns available for oledb interface:

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

Seems System.Search.QueryFocusedSummary is not exposed, while System.Search.AutoSummary is. Maybe that's why you can't get the column.



来源:https://stackoverflow.com/questions/6071766/windows-search-sql-cant-access-system-search-queryfocusedsummary

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!