You are here: Home » Creating a custom search page for searching a specific search scope in SharePoint 2007

Creating a custom search page for searching a specific search scope in SharePoint 2007

Posted by tonstegeman
No Comments »

The search options in MOSS 2007 now have scopes. By using a search scope users of your search pages can easily just search in specific parts of the content. To create a scope, you define rules. These rules have a ‘source rule type’, which can have 3 values:

  • url (‘scope’ the search results based on url)
  • propery query (‘scope’ the search results based on the value of a property (a property restriction)
  • content source (‘scope’ the search results based on the content source they are part of)

In our intranet we have added a field called ‘InformationType’ to all content that we upload. All our sites that are ‘Knowledge’ related, automatically classify the content in it as Knowledge. By using a scope we can make it much easier for our users to just search in knowledge related content. After that we created a custom search page, specific for knowledge that just searches in ‘Knowledge’.

Here’s a quick how-to (especially the last step took some time for me to find out….) The trick is that the Search Core Results webpart has a property called “Scope”, which is hidden in the Miscellaneous section, which is not where I expected it…. Here you can manually enter the name of the scope you want to use.

Here’s a brief How-To:

  1. Create a sitecolumn called InformationType and add at least 2 different values
  2. Attach the sitecolumn to some libraries or lists
  3. Upload/Add some content and select at least 2 different values
  4. Do an incremental crawl of your search index
  5. Create a managed property:
  • Go to the “Metadata property mappings” page (see search options in the SSP)
  • Click “New Managed Property”
  • Enter “InformationType” as the name
  • Click “Add Mapping” and search for your InformationType property (this is why you need to do the crawl in step 4, otherwise it won’t show up).
  • Check “Allow this property to be searched in scopes”
    Search1
  • Run a full crawl on your index
  • Go to “View Scope” in the search settings on your SSP and create a new scope
  • In the Scope overview click “Add Rule” in the “Updates Status” column
  • Set the Scope Rule Type to “Property Query” and add the appropriate property restriction (InformationType equals “Knowledge”)
    Search2
  • Go back to the search settings and click “Start updates now”.  The scopes have to be compiled before they work.
  • Add the InformationType to your scope dropdown (this is an easy one to forget):
    • Go to the top level site settings
    • Click “Search scopes” in the site collection administration setting
    • Click on the link “Search Dropdown” (name of a display group)
    • Check the checkbox for your new “Knowledge” scope
      Search3
    • Get a coffee (it actually takes some time before the scope appears in the dropdown….)
    • Test if the scope works
  • Add a new page (use a page layout that can have webparts) to your site
  • Or alternatively add a new search tab to your search center
  • Add the “Search Box” and the “Search Core Results” webparts to your page
  • In the Miscellaneous section of the Search Box, set the value for “Target search results page url” to your new page (which in my demo case is the homepage of and ordinary WSS teamsite).
    Search4
  • Set the “Scopes dropdown” mode to “Do not show scopes dropdown”
  • And the last one (which took me some time to figure out….): Set the Scope value in the Miscellaneous section to “Knowledge”.
    Search6
  • Test your page:
    Search7

    Users now never have to think about in what content they are searching, they just search “Knowledge” Their search results are just documents from the knowledge collection, instead of all being mixed with all other content that is out there.

     

  • Your email is never shared.
    Required fields are marked *




    Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>