Configuring Custom Fields in SharePoint Advanced Search

Written by:

Introduction

This blog will show how to add the custom fields to the MetaData Properties in Central Admin as well as adding them to the Advanced Search page. It will also detail how to add the advanced search button to your site’s search box. This will allow for your customers/clients to search on the fields that they know and understand when migrating a system or creating a new system for an old issue.

Configure Central Admin

The below is a step by step process for adding these fields to the MetaData Properties section of search administration. You will need to be logged into the Shared Service Provider admin page inside Central Admin.

Select Search Administration from the SSP Administration page:

Figure 1 Search Administration

Select MetaData Properties from the Left Navigation Area:

Figure 2 MetaData Properties

Select New Managed Property:

Figure 3 New Managed Property

It is my recommendation to name the property as close to the actual property name as possible. In this example the Property Name is “Letter Type” There are no spaces or special characters allowed in the property name. I removed the space in the field name. This is a choice box so the information in the property is text. Click add mapping and find the correct maping, filter by SharePoint and find the correct mapping which is the field name. NOTE: the syntax will be ows_Letter_x0020_Type this x0020 is for the space in between the two words. Also if you have renamed this property it will remain as the original name in this area.

Figure 4 Property Settings

Click ok and ensure your search scope is set to “all content”

Initiate a full crawl of the content.

This concludes the central admin portion of this post. We will now Add and configure the advanced search page to show our custom fields as searchable properties. This piece is the tedious part.

Configure The Search Center

Create the Advanced Search page on your Site through Site Settings >Create >Enterprise Templates >Search Center. Once this is complete go to the Advanced Search button next to the Search box on the Search Center Page.

Figure 5 Advanced Search Page

Edit the Page in order to get to the Shared Web Part Modification GUI.

Figure 6 Edit Page

Figure 7 Modify the Shared Web Part

Expand the Properties Section of the Web Part Editing GUI and click in the Properties line of text and click the expand button. This will open the Search Properties Code. You will need to add the code for the custom fields. This is tedious but not specifically hard as I am not a programmer but was able to figure it out.

Figure 8 Web Part Properties

Once the Properties Text Box is opened in a “pop-up” window scroll down past the Language Section to the Property Definitions Area of code, add your fields to the bottom before the </Propertey Defs> closure section of Code. I expanded the size of the “pop-up” so that it was easier to see I also put in the proper line breaks for organizational purposes. You will also need to add them to each Result Type in the code but you can copy and paste once the first is changed. You can also add a PDF document as a Result Type in this section.

The Syntax for the Property Definitions is as follows:

<PropertyDef Name=”LetterType” DataType=”text” DisplayName=”Letter Type”/>

Make the Display name exactly as it appears in the list to avoid confusion, make the PropertyDef Name what you put in the MetaData Properties section of Central Admin and make the Data Type match that of the MetaData Property in Central Admin.


Figure 9 Property Definitions

The Syntax for the Result Type Section is as follows:

<PropertyRef Name=”LetterType” />

This PropertyRef Name will equal the MetaData Property name you entered in Central Admin

REMEMBER TO COPY THIS FOR ALL RESULT TYPES

Figure 10 Result Types

Add it to your Sites

Once this is finished go to Site Settings> All Site Settings> Go To Top Level Site Settings> Search Settings

Once there select Use Custom Scopes radio button and enter your advanced Search Page URL into the box. Click “OK” and the Advanced Search Link will be next to all Search Boxes on your site.

Figure 11 Add the Link

Figure 12 Advanced Search

Test Results show that the Custom Fields do in fact show results after these changes were made.

Please let me know if there are any issues.

Posted on November 19th, 2009 in Technology, Tips & Tricks.