Bookmark and Share Subscribe Bookmark and Share

Categories

Advertisement



Adding a custom search result Column (metadata) to MOSS Advanced Search

Sep
07


 « »    

Summary

You may have a human resources document library where the users would like to search by the “SocialSecurityNumber” column property that was manually populated during the uploading of a document. You could follow these steps to make the “SocialSecurityNumber” SharePoint column “selectable and searchable” from the SharePoint Advanced Search Template.

Below is a summary of the different sections of this article and what the section covers:

  • Adding Metadata Property Mapping – This step changes the column to a manageable field within SharePoint, if a unless its managed it is not searchable when a crawl is ran. This can be done manually or automatically.
    • Manually adding Metadata Property Mapping
    • Automatically adding Metadata Property Mapping
  • Adding a field to MOSS Advanced Search – This step adds the column name to the dropdown box in the MOSS Advanced Search, there are 2 edits you have to make, the PropertyRef’s tag and the ResultsType ProperyRef tag.
    • Editing the “PropertyRef” tag
    • Editing the “ResultTypes” “PropertyRef” tag
  • Testing – This step covers testing of your changes
  • Errors – This step covers a couple of known error messages

Adding Metadata Property Mapping

This article will describe how to add the column “test” to the advanced search dropdown box and make it “searchable”. This procedure can be duplicated for any column type.

Manually adding Metadata Property Mapping

  1. Go to Central Administrator
  2. Go to Shared Service Provider Administrator (http://CENTRALADMINURL/ssp/admin)
  3. Select “Search Settings” from the option in the search menu
  4. Select “Metadata Property Mappings”
  5. Select “New Managed Property” (Figure 1.1)
    1. Type in the property name, this should match the column name
    2. Set the type, this should be the same type of value as when you created the column
    3. Select “Include values from a single crawled property based on the order specified” and click add mapping. The quickest way is to do a test for the column name. In this case it is ows_Test(Text). This property will not show up unless you have preformed a full or incremental crawl and they need to be populated with data or they will not show up.
    4. Select “Allow this property to be used in scopes”
    5. Click OK

Figure 1.1 New Managed Property window

Automatically adding Metadata Property Mapping

  1. Go to Central Administrator
  2. Go to Shared Service Provider Administrator (http://CENTRALADMINURL/ssp/admin)
  3. Select “Search Settings” from the option in the search menu
  4. Select “Metadata property mappings”
  5. Select “Crawled Properties” from the menu on the left
  6. Go to “SharePoint” folder, select the drop down menu and select “Edit Category”
    1. Make sure the following three checkboxes are checked off Automatically discover new properties when a crawl takes place
    2. Map all string properties in this category to the Content managed property.
    3. Select “Automatically generate a new managed property for each crawled property discovered in this category”
  7. Press OK (new property will not show up unless you have preformed a full or incremental crawl and they need to be populated with data or they will not show up)

Adding field to MOSS Advanced Search

  1. Go to the MOSS site where you which to perform the search
  2. Select “Advanced Search”. If Advanced Search is unavailable then you have created the site with a template that does not contain a search center. You will need to add a search page to the site from Site Settings >
  3. Select “Edit Page” from the “Site Actions” menu

  1. Select “Modify Shared Web Part” under the “edit” menu

  1. Under the properties of the web part select the “Ôò¼├┤Ôö£├ºÔö¼┬¼” link next to properties field under the properties section

  1. Copy all of the content from the popup window into notepad. You will need to edit 2 sections

Editing the “PropertyDef” tag


Look for the section with the “PropertyDefs” tag. Create a new entry as displayed below, make sure it matches the data type you selected when you created the “Metadata Mapping” earlier and also make sure the “name” matches the column name

<PropertyDefs>

<PropertyDef Name=”Path” DataType=”text” DisplayName=”URL”/>

<PropertyDef Name=”Size” DataType=”integer” DisplayName=”Size”/>

<PropertyDef Name=”Write” DataType=”datetime” DisplayName=”Last Modified Date”/>

<PropertyDef Name=”FileName” DataType=”text” DisplayName=”Name”/>

<PropertyDef Name=”Description” DataType=”text” DisplayName=”Description”/>

<PropertyDef Name=”Test” DataType=”text” DisplayName=”Test”/>

<PropertyDef Name=”Title” DataType=”text” DisplayName=”Title”/>

<PropertyDef Name=”Author” DataType=”text” DisplayName=”Author”/>

<PropertyDef Name=”DocSubject” DataType=”text” DisplayName=”Subject”/>

<PropertyDef Name=”DocKeywords” DataType=”text” DisplayName=”Keywords”/>

<PropertyDef Name=”DocComments” DataType=”text” DisplayName=”Comments”/>

<PropertyDef Name=”Manager” DataType=”text” DisplayName=”Manager”/>

<PropertyDef Name=”Company” DataType=”text” DisplayName=”Company”/>

<PropertyDef Name=”Created” DataType=”datetime” DisplayName=”Created Date”/>

<PropertyDef Name=”CreatedBy” DataType=”text” DisplayName=”Created By”/>

<PropertyDef Name=”ModifiedBy” DataType=”text” DisplayName=”Last Modified By”/>

</PropertyDefs>

Editing the “ResultTypes” “PropertyRef” tag

Look the section with the “PropertyRef” tag. There are a couple of different “PropertyRef” sections, make sure to select the one with the property “Display Name=”All Results””. Add a new entry as displayed below. The name should match the column name.


<ResultTypes>

<ResultType DisplayName=”All Results” Name=”default”>

<Query/>

<PropertyRef Name=”Author” />

<PropertyRef Name=”Description” />

<PropertyRef Name=”FileName” />

<PropertyRef Name=”Size” />

<PropertyRef Name=”Path” />

<PropertyRef Name=”Test” />

<PropertyRef Name=”Created” />

<PropertyRef Name=”Write” />

<PropertyRef Name=”CreatedBy” />

<PropertyRef Name=”ModifiedBy” />

</ResultType>

  1. Copy the whole modified XML schema back into the popup window and press OK. Then press Apply then OK on the Advanced Search Box window.

2. Select Publish from the top of the search window

3. You have to perform a full crawl on the site to be able to search one of the custom fields. During testing, we performed an incremental crawl however it did not return any search results until we preformed a full crawl.

Testing

Successful Test

We will attempt to search for the “blue05” metadata under the “test” column. As you can see the document “red05” contains the “blue05” metadata in the “test” column

Searching for blue05 under Test

The search results are successful this returned the “red05” document with the “blue05” metadata under the “test” column.

Unsuccessful Test

Searching for “red05” metadata under the test column. This search should not work because “red05” is under the “title” column and not under the “test” column.

This does not return any results because the column “test” only contains the metadata “blue05”

Errors

  1. Property doesn’t exist or is used in a manner inconsistent with schema settings. – If you do not add the metadata field in search settings or run a crawl after you create the metadata mapping you will get this error.
  2. No results matching your search were found. – If you did not run a full crawl after adding the field to the XML schema, you will get this error.


    Did I save you time and headaches? Buy me a cup of coffee.
    The more coffee I drink the more articles I can write.