Skip to main content
Email Password   helpLost your password?

Sample Image - sample.gif

Introduction

This set of user controls gives Microsoft Content Management Server (MCMS) web sites search capability using SharePoint Portal Server (SPS) as the search engine. It uses SPS' Search web service to provide a simple keyword search. A search option is provided to select specific Content Index. The search results are displayed in a customizable DataGrid.

A C# version of this set of user controls is available here.

SharePoint Setup

Please reference Emmanuel Desigaud's article on how to set up SPS for search. Basically, you need to set up a Content Index and add a Content Source. Also, make sure users performing searches in your CMS site have access to the SPS Search web service.

Installation

  1. Copy SPSSearch.xml to your XML directory if you have one, or any location in your web site. If you like to include additional columns in your search results, add the additional fields to the select statement. You can also change the maximum number of search results returned in <Count>500</Count>, if so desired.
  2. Copy user control SearchInput to your user controls directory. The default search button is a text button. If you like an image button instead, change the Visible attribute of SearchButton and SearchImageButton accordingly and update the ImageUrl of the SearchImageButton. Do not delete either button even if you are not using both.
  3. Copy user control SearchResults to your user controls directory. If you have added additional fields in SPSSearch.xml, customize SearchResult.ascx to include those fields.
  4. You may need to qualify some namespaces in SearchInput.ascx, SearchInput.ascx.vb, SearchResults.ascx and SearchResults.ascx.vb with your project name.
  5. Copy QueryService.vb and SearchUtilities.vb to your class directory.
  6. Copy Search.css to your CSS directory.
  7. In your web.config, add the following keys to the appSettings:
    <appSettings>
        <add key="QuestechSystems.SPSSearchUrl" 
          value="http://<SPSServer>/_vti_bin/search.asmx" />
        <add key="QuestechSystems.SPSSearchXml" value="[Url to SPSSearch.xml]" />
        <add key="QuestechSystems.SPSSearchIndexesText" 
            value="[A comma delimited list of Content Indexes Display Name]" />
        <add key="QuestechSystems.SPSSearchIndexesValue" 
            value="[A comma delimited list of Content Indexes]" />
    </appSettings>

    For example:

    <appSettings>
        <add key="QuestechSystems.SPSSearchUrl" 
          value="http://<SPSServer>/_vti_bin/search.asmx" />
        <add key="QuestechSystems.SPSSearchXml" 
            value="/<CMS Site Application Name>/Xml/SPSSearch.xml" />
        <add key="QuestechSystems.SPSSearchIndexesText" 
            value="All,Sub Site 1,Sub Site 2" />
        <add key="QuestechSystems.SPSSearchIndexesValue" 
            value="All,Sub_Site_1_Content_Index,Sub_Site_2_Content_Index" />
    </appSettings>

    A drop down list for the Content Indexes specified will be added in the SearchInput user control. The "All" in SPSSearchIndexesValue is a special value that defines search to be performed on all Content Indexes defined in SPSSearchIndexesValue. If you only have one Content Index to search, add the following instead:

    <appSettings>
        <add key="QuestechSystems.SPSSearchUrl" 
          value="http://<SPSServer>/_vti_bin/search.asmx" />
        <add key="QuestechSystems.SPSSearchXml" 
            value="/<CMS Site Application Name>/Xml/SPSSearch.xml" />
        <add key="QuestechSystems.SPSSearchIndexesValue" 
                           value="Site_Content_Index" />
    </appSettings>

    No drop down list will be added for this case.

  8. Add user control SearchInput to your CMS site to where you want the search input box to show. The results page URL is specified via the SearchResultsUrl property. The search results page can be a CMS template page or a regular ASP.NET page. For example:
    <%@ Register TagPrefix="uc1" 
      TagName="SearchInput" Src="~/UserControls/SearchInput.ascx" %>
    . . . . . .
    <uc1:SearchInput id="SearchInput" 
        SearchResultsUrl="" DefaultSearchIndex="" runat="server">
    </uc1:SearchInput>

    If SearchResultsUrl is not specified, the current page will be used for the results page. If you have specified multiple Content Indexes, you can select the default Content Index to search, using the DefaultSearchIndex property. Customize SearchInput.ascx to change the layout of the search input elements.

  9. Add user control SearchResult to your search results page. The control has two properties you can set:
  10. Include Search.css to all pages that reference the search controls.
  11. Include all new files to your CMS project. Rebuild your site in VS.NET.

Notes

  1. If SearchResults encounters any errors, it will mask the errors and return "No pages were found". To see the actual errors, add querystring "debug=true" to the search results page and reload the page.
  2. The search controls run in CMS Unpublished mode. The links returned in the search results are all published links, however.

History

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralSearch stats utilities Pin
Viracboy
7:41 3 Mar '06  
Generalbest bets Pin
Viracboy
13:23 31 Jan '06  
GeneralSearch Results Include Documents Pin
Jeff Tsang
6:31 28 Oct '05  
GeneralRe: Search Results Include Documents Pin
Stephen Huen
16:22 30 Oct '05  
Generalsps version Pin
Viracboy
8:30 22 Jun '05  
GeneralRe: sps version Pin
Stephen Huen
20:31 22 Jun '05  
GeneralRe: sps version Pin
Portatofe
9:30 2 Oct '08  
Generalregarding CMS Search Pin
skumar@infoprocorp.com
4:09 2 Dec '04  
GeneralRe: regarding CMS Search Pin
Stephen Huen
9:03 2 Dec '04  
GeneralPage Description property Pin
magarcia
23:39 24 Aug '04  
GeneralRe: Page Description property Pin
Stephen Huen
17:56 25 Aug '04  
GeneralRe: Page Description property Pin
Viracboy
7:06 21 Feb '06  
GeneralRetriving the resume of the posting Pin
magarcia
0:56 19 Aug '04  
GeneralRe: Retriving the resume of the posting Pin
Stephen Huen
8:13 19 Aug '04  
GeneralRe: Retriving the resume of the posting Pin
magarcia
3:36 24 Aug '04  


Last Updated 27 Jun 2005 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009