Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
Hello,

I'm trying to read System.Search.QueryFocusedSummary 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 with Windows Search 4.0.

My query is:

SELECT TOP 25 System.FileName, System.ItemDate, System.Message.Store, System.Search.Store, System.Kind, System.Search.AutoSummary, System.Search.QueryFocusedSummary From SystemIndex where (System.Kind != Some Array['folder'] AND System.Kind != SOME ARRAY['contact']) AND (scope='mapi:' OR scope='file:') AND CONTAINS('hello') ORDER BY System.ItemDate DESC"

When I remove System.Search.QueryFocusedSummary, the query works. How can I get the query working with System.Search.QueryFocusedSummary?

Thanks in advance.
Posted
Updated 17-May-11 3:00am
v2
Comments
csharpnewbie2 19-May-11 15:30pm    
Here is the code:
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

}}}}
rameshdotv 21-Jul-11 1:14am    
i am facing some problem by using windows search 4.0 for searching in files.
this is the error
One or more errors occurred during processing of command.
IErrorInfo.GetDescription failed with E_FAIL(0x80004005).

my query is this

SELECT TOP 300 "System.ItemName", "System.ItemPathDisplay", "System.Search.Rank" FROM 164.164.40.251.SystemIndex WHERE ((CONTAINS(*,'"java*"',1033) RANK BY COERCION(Absolute, 1)) OR (FREETEXT(("System.ItemNameDisplay":0.9, *:0.1), 'java', 1033) AND CONTAINS(*,'"java"',1033))) AND (SCOPE = 'file://164.164.40.251/Resumes\HTMLResumes' ) ORDER BY System.Search.Rank DESC

can anybody help me on this ?

Thanks & Regards

V.Ramesh
Manfred Rudolf Bihy 19-May-11 16:34pm    
This code has nothing to do with the question. Besides that I wanted OP to show how the result was being processed and not how the result was obtained. You probably haven't understood the solution I already provided to OP.
csharpnewbie2 24-May-11 12:06pm    
MRB, Please explain your post. What is OP? I want to read the QueryFocusedSummary field. I believe it is not a field found in the SystemIndex cache...so how can I get it?
csharpnewbie2 24-May-11 12:07pm    
MRB, I could not find the field in the resultset.

1 solution

Hello Ravi Danum[^],

the MSDN documentation has this to say about System.Search.QueryFocusedSummary[^]:

"The query-focused summary of the document. This is automatically created by the search system. Use this property only when consuming the values in your application, not for providing values to a property handler."

This essentially says that it is not a column in the search index, but rather built as a summary by the query execution process. Please try in your code if you can read this property from the result set. Since you haven't posted any code that does the actual processing of the results I'm a bit in the air here since I have sofar no experience in using this API. Maybe expanding on your question with a bit more code would help us pinpoint where you can try to read this value.

Best Regards,

-MRB
 
Share this answer
 
Comments
csharpnewbie2 20-May-11 12:52pm    
Here is the code:

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

}}}}
Martijn Boeker 7-Jun-11 14:52pm    
I'm having the same problem. We can use Windows Search to find files and the API appears to have the ability to give a small summary that indicates why the file is a match to the search criteria (System.Search.QueryFocusedSummary). This allows us to render the search results in a similar way that Google does. The real question is, how do we get this value?

To read values through the search SQL syntax, you must select the columns you want to retrieve. I think the comment in the MS document means that System.Search.QueryFocussedSummary is a column that can be used only in the SELECT part of the query, not in the WHERE clause.

If I run a search query, the number of columns returned is the same as the number of columns in the query. There is no extra column as MRB is suggesting.
Martijn Boeker 7-Jun-11 15:04pm    
I reported this as 'not an answer', hoping that this will be an unanswered question again so perhaps someone else will be able to check this out and provide a solution to this problem.
Martijn Boeker 7-Jun-11 15:07pm    
I don't have much hope though :-)
http://social.msdn.microsoft.com/Forums/en-US/windowsdesktopsearchdevelopment/thread/dcfb40ea-b250-4294-80d0-727c7365745e

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900