Sunday, August 20, 2006

Add document properties to advanced search in SharePoint 2007

When looking for more information about how you can add your own document properties to the advanced search web part I first found this information from Ishai Sagi - Found it! How to add properties to advanced search in MOSS 2007 where he demonstrates how you can add a property from the user profile database to the advanced search web part. I was however looking for something different. I created a InfoPath forms library in which I added my own custom fields/properties and I wanted to add these to the advanced search webpart.

This MSDN article - Managing properties explains that the SharePoint 2007 search schema has 2 different types of properties: crawled properties and managed properties. So if you want to use a property in the Search web parts you will need to create a managed property.

Let’s see how you do this:

Open SharePoint Central Admin > Go to Shared Services Administration. Go to Search Settings. On the Configure Search Settings, you can see how many Managed properties are defined.

Click on the link behind Managed properties. This will open the Document Property Mappings page. Crawled properties are automatically extracted from crawled content. Users can however only perform queries over managed properties. After you map your crawled property on a managed property you can use it after the next full crawl.

Click New Managed Property – give a name and description and click on the Add Mapping to open the Crawled properties screen and to create the mapping. Let’s create a new managed property called Theme.

Perform a full crawl to make the new Managed Property available

As Ishai describes in his article, you can customize the Advanced Search Web Part by simply modifying the settings. You can also create your own custom search page. Liam also has a great posting about the different new available options to use the SharePoint Search web parts. Now let’s add the new Managed property called Theme :

Open a SharePoint 2007 team site and create a new web part page. Click on Site Actions > Edit Page. Click Add web part > Select Advanced Search Web Part.

Click Modify Shared Web Part - underneath the Properties section, you will see the Properties property – obvious no, ;-) …

This Properties web part property contains an XML string which defines what are the different options visible in the Advance Search web part. The main XML nodes are these:
  • LangDefs: defines which languages can be used
  • Languages: refers to the LangDefs XML node to actually define which languages are shown in the web part.
  • PropertyDefs: defines which properties can be used, here you need to add your own new managed property - <PropertyDef Name=”Theme” DataType=”text” DisplayName=”Theme” />
  • Underneath the ResultTypes node – you can find the different result types : documents, word documents, excel documents, presentations or All results. To make your own property visible underneath All Results you need to add the next string <PropertyRef Name=”Theme” /> underneath <ResultType DisplayName=”All Results” Name=”default” />

I think that this actually shows that the new SharePoint 2007 web parts already provide a lot of functionality out of the box which can be easily customized. The only thing I’m still waiting for is some more documentation on the subject.

Technorati : microsoft, moss 2007, office12, office2007, sharepoint, sharepoint2007, wssv3 , search


Sheetal Jain said...

This is very helpful.. Thanks.. I was going to write something similar for my team... but now I just need to send them a link :)

Anonymous said...

advance search web

Here's some useful info on advance search web
which you might be looking for. The url is: