Windows 7 Federated Search - How to make it send search requests to my .net assembly

风格不统一 提交于 2019-12-04 13:43:37

问题


I am trying to display search results in the windows 7 explorer thru the federated search feature, from a local .net assembly. (not from a web service)

I have found various tutorials, but all of them are for web services. Earlier I thought that it was not possible but then, I came across the StickyNotes federated search connector. The contents of the .OSDX file are:

<?xml version="1.0" encoding="UTF-8"?>
<searchConnectorDescription xmlns="http://schemas.microsoft.com/windows/2009/searchConnector">
  <description>Create short handwritten or text notes.</description>
  <isSearchOnlyItem>true</isSearchOnlyItem>
  <includeInStartMenuScope>true</includeInStartMenuScope>
  <templateInfo>
    <folderType>{982725EE-6F47-479E-B447-812BFA7D2E8F}</folderType>
  </templateInfo>
  <simpleLocation>
    <url>StickyNotes://{S-1-5-21-3431700657-2522803235-1547684158-1000}/notes</url>
    <serialized>MBAAAEAFCAAAAAAAADAAAAAAAYUgAAQBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAYKAUAwHAykg1PPWtiyRvmVorPeOnkJkAQEATBAdAkGAjBwaAkHAOBwbAQHAlBwcAoDAvAwLAsHATBQLAEDAtAQNA0CAyAQMA0CAzAANAMDAxAwNAADAwAgNAUDA3AQLAIDA1AgMAIDA4AAMAMDAyAwMAUDAtAQMAUDA0AwNAYDA4AANAEDA1AAOA0CAxAAMAADAwAQfA8CAuBwbAQHAlBwcAAAAAAAAAAAAAAA</serialized>
  </simpleLocation>
</searchConnectorDescription>

This means that it is possible to forward a search query to a local datastore/dll/exe

I would like to use my .net app to provide search results in the same/similar way. Where do I start?

See: Windows 7 Federated Search Provider Implementer’s Guide

My aim is to make a documents library database (sqlite) searchable via the windows explorer and list the files and their meta data from the DB in explorer (files are stored locally).


回答1:


This project appears to accomplish this in C#: http://mossph.codeplex.com/

The project implements ISearchProtocol using IContentEnumerator, IFilter and IUrlAccessor. Everything propogates from an implement of a ContentEnumerator class.




回答2:


The info on MSDN has been updated.
http://msdn.microsoft.com/en-us/library/dd378288%28v=vs.85%29.aspx

It now lists:

HRESULT GetResults(
  [in]   HWND hwnd,
  [in]   LPCWSTR pszQuery,
  [in]   DWORD dwStartIndex,
  [in]   DWORD dwCount,
  [in]   REFIID riid,
  [out]  void **ppv
);

Parameters

hwnd [in]

Type: HWND
The window handle of the caller.

pszQuery [in]

Type: LPCWSTR
The query as entered by the user. This parameter is equivalent to the OpenSearch {searchTerms} parameter and may be empty.

dwStartIndex [in]

Type: DWORD
The index of the first result being requested. Equivalent to the OpenSearch {startIndex} parameter. See Remarks below.

dwCount [in]

Type: DWORD
The number of results being requested. Equivalent to the OpenSearch {count} parameter.

riid [in]

Type: REFIID
The IID of the interface being requested. Typically IID_IStream.

ppv [out]

Type: void** An interface pointer, of type specified by RIID, to the object containing the results in Atom or RSS format.

At least we know that a valid riid is IID_IStream

The info for that is here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa380034%28v=vs.85%29.aspx



来源:https://stackoverflow.com/questions/2385851/windows-7-federated-search-how-to-make-it-send-search-requests-to-my-net-asse

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