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:
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 :
- 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.