Tuesday, June 15, 2010

Searching by Columns in MOSS 2007

Searching by Columns in MOSS 2007

How can we search by columns in MOSS? This is a very common question from users. When we want to search by a column in announcements, document library, tasks or any kind of sharepoint lists, we need to create a managed property to map wih the column first and then we will be able to search for that column in the Advanced Search page. I will explain the steps of creating managed properties below.

Create a custom column and start a incremental crawl

  • After you create a new column, e.g. "Status", in a SharePoint list, you need to kick off a crawl. In order to have the crawler find the new column quickly, simply add an new entry to the list with some value in the new column temporarily and then start an incremental crawl. This will make the crawler to find and only crawl the new column you created very quickly.
  • After the crawl is completed, go to the "Search Settings" page of your Shared Service Provider (SSP) Admin page
  • Click on "Metadata property mapping"

Create a Managed Property and map it to a Crawled Property

  • Click on "New Managed Property" in the toolbar
  • In the new form, please enter a name for the managed property, e.g. "PropjectStatus"
  • Select the correct data type, e.g. "Text"
  • Click on "Add Mapping" to open up a "Crawled Property selection" WebPage dialog
  • Type the name of your column in the "Crawled property name" field and click "Find" button, e.g. type "Status"
  • You will see the column name showing in the "Select a crawled property" list.
  • For new column, you should select the column name without "ows_" prefix.
  • But for existing/built-in SharePoint column, you can select the column name with "ows_" prefix. Every built-in SharePoint colum has a crawled property and has the "ows_" prefix.
  • Press OK to complete the form.
  • Start another full crawl. This crawl will map column value/data to the managed property for faster searching.

Modify the Advanced Search page

In order to search for the column from the UI, you need to add an new entity into the property dropdown in the Advanced Search page.

  • Go to the Search Center page of your portal
  • Click on "Advanced Search"
  • Click on "Site Action" and select "Edit Page"
  • Click on "Edit" in the Advanced Search box and select "Modify Shared Web Part"
  • On the right pane, find the XML text box under Properties section.
  • Copy and paste the XML text into notepad to edit the XML.
  • Make the following modification:
    • In the node, please add , e.g. , where DisplayName attribute is to specify the name showed in the property dropdown.
    • In one of the nodes, please add , e.g.
  • Copy and paste the XML text from notepad back into the XML text box
  • Click OK.
  • Check if the dropdown menu has the new property added

Test the Managed Property

  • Go to the "Advanced Search" page
  • Select the Result Type you added the property
  • In the "Pick Property" dropdown, select the managed property you newly added.
  • Type some value, e.g the value you temporarily entered in the very first step
  • Click Search
If you have any questions, send me an email at anand.chandawarkar@gmail.com

No comments: