Click here to Skip to main content
Click here to Skip to main content

Integrate Windows Desktop Search 2.x with Web Search

, 3 Dec 2006 CPOL
Rate this:
Please Sign up or sign in to vote.
An article on integrating Microsoft's Windows Desktop Search engine with Web search on an intranet
Sample Image - WdsIntegration.jpg

Introduction

Companies often provide an intranet for employees to share information and communicate. A good intranet will provide some level of search capability to allow users to find what they need on the intranet quickly and easily. In many instances, however, the bulk of content within an organisation is not stored in or attached to a formal intranet. It is stored in individual email archives, on hard drives or in shared stores such as NAS or SAN. Applications such as Google Desktop and Windows Desktop Search index this hidden content to make discovery easier across this unmanaged content.

However, this now presents a user two (or more) search experiences. Desktop search can begin to undermine the company's intranet strategy by becoming a user's first port of call when trying to find information. This is the issue that I have tried to address by fully integrating an existing Web-based intranet search capability and desktop search.

Windows Desktop Search already easily allows an intranet search button to be added to the list of available search locations. This article focuses instead on the reverse scenario - integrating desktop search results into the intranet search page. This is modelled off the Google Desktop experience. If you have Google Desktop installed and you search at google.com, the first set of results display are 'results from your desktop' followed by results from the Internet. This makes google.com the focus for a user trying to find both local content as well as Internet content.

Background

The solution presented here builds on the APIs and ideas provided here.

Using the Code

The file DesktopSearch.cs contains one class called DesktopSearcher. The two main functions are:

  1. public DataTable ExecuteQuery(string query, int maximumNumberOfResults, 
        string columns, string sortByColumn, string restriction)
  2. public string ExecuteQueryXml(string query, int maximumNumberOfResults, 
        string columns, string sortByColumn, string restriction) 

Both take the same parameters (fairly self explanatory), the only difference being the format of the results. For the purposes outlined above, the XML result format is most useful.

Within the intranet search page, a simple JavaScript call to this component onload allows the search page to retrieve local results from the user's locally installed desktop search, use an XSL to transform the results into XHTML and insert the results into the overall result set.

From the attached example, the JavaScript required would be:

function searchDesktop(queryIn)
{
    var query = queryIn;
    var cols = "Rank, DocTitle, DocAuthor, PrimaryDate, 
        PerceivedType, DisplayFolder, Url, FolderName, Store";
    var sortBy = "Rank DESC";
    var where = null;
    
    var searcher = new ActiveXObject("DesktopSearch.DesktopSearcher");
    var searchResult = "failure";
    searchResult = searcher.ExecuteQueryXml(query, 15, cols, sortBy, where);
    
    var resultsDiv = document.getElementById('DesktopSearchResults');
    var resultsDivRaw = document.getElementById('DesktopSearchResultsRaw');
    resultsDivRaw.value = searchResult;
    
    var xml = new ActiveXObject("Microsoft.XMLDOM");
    xml.async = false;

    xml.loadXML(searchResult);

    // Load XSL
    var xsl = new ActiveXObject("Microsoft.XMLDOM");
    xsl.async = false;
    xsl.load("desktop.xsl");
    
    resultsDiv.innerHTML = xml.transformNode(xsl);
    resultsDivRaw.value = searchResult;
}

Issues

  • At the moment, URLs for results returned from Outlook are not reliable when output as <a> links.
  • As the solution relies on ActiveX, this is an Internet Explorer solution only.
  • Also, the zone that serves up the DLL must be trusted to avoid an Internet Explorer warning dialog.

History

  • 3rd December, 2006: Initial post

License

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

Share

About the Author

Andrew Bingham
Web Developer
Australia Australia
No Biography provided

Comments and Discussions

 
GeneralNot able to execute the demo project Pinmemberavijitdas31-Oct-07 2:51 
GeneralRe: Not able to execute the demo project PinmemberAndrew Bingham31-Oct-07 16:38 
GeneralRe: Not able to execute the demo project Pinmemberavijitdas1-Nov-07 22:35 
General??? Does not work Pinmemberlaneh200613-Dec-06 10:19 
QuestionRe: ??? Does not work Pinmemberlaneh200614-Dec-06 5:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.1411022.1 | Last Updated 3 Dec 2006
Article Copyright 2006 by Andrew Bingham
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid