in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

andymay's blog

MOSS 2007 - Advanced Search on your own metadata

Two of the great new things about MOSS2007 are Content Types and the extensibility of the Search function. Put the two together and very quickly you’ll come up with the scenario where you’ve created a nice comprehensive set of metadata which you’ve now applied to all the sites and libraries in your site collection, and now you want search on those metadata items.

 

The Advanced Search web part (typically surfaced through the Search Centre) looks like it’s going to do the job for you, with a drop down box which lets you restrict your search based on properties, but out-of-the-box it quickly becomes apparent that only a subset of the standard properties are there, not your own site columns. The ones you get as standard are:

 

Author

Description

Name

Size (MB)

URL

Created Date

Last Modified Date

Created By

Last Modified By

 

 

There are a couple of additional steps which you have to carry out to make your own appear there, most of which have been documented in various places but I couldn’t find a complete end-to-end walk through for the process, so this is it.

 

Firstly, I’ve assumed that you’ve already set up the site columns, assembled them as content types, and made those content types available within the document libraries of your sites. In my case, I have a set of them which form the core metadata schema for my customer – a mixture of default and bespoke ones.

 

Contributor                 (multiline)                    default

Date Created               (date/time)                   default

Disposal Action          (choice)                       bespoke

Disposal Date              (date/time)                   bespoke

Disposal Review         (date/time)                   bespoke

Document Type          (choice)                       bespoke

Relation                       (multiline)                    default

Title                             (single line)                  default

Topic                           (choice)                       bespoke

Created By                  (person/group)             default

Modified By               (person/group)             default

Checked Out To         (person/group)             default

 

The problem comes about because within Sharepoint 2007 there are two types of properties – crawled and managed. Crawled properties are automatically extracted from crawled content, but users can however only perform queries over managed properties. Thankfully Sharepoint lets us map one or more crawled properties onto a managed property and then, after the next crawl, those properties become available.

 

That description – one or more – is quite important as it permits an element of ‘fuzzy searching’ whereby the metadata category which the user wants to search on may be implemented in a number of different ways across different content types. This lets us hide that from the user.

 

The place to start is Central Admin – Shared Services Administration – Metadata Poperty Mappings. This is where you can check whether the properties you want are already being managed, or whether you will need to add them. For my list above, the “Created By”, “Created Date” [aka “created”], “Title” [aka “DisplayTitle] and “Modified By” properties are present but the “Contributor”, “Disposal Action”, “Disposal Date”, “Disposal Review”, “Document Type”, “Relation”, Topic and “Checked Out To” ones will need to be added. NB It may also be necessary to check the existing ones and add any additional new crawled properties to the list.

 

Adding them is really only a case of clicking the “new managed property” button, giving the property name (no embedded spaces allowed), a description, a type (text, integer, date, etc) and then deciding which crawled property (or properties) to map to.

 

In my case I’m mapping as follows

 

Managed Property

Type

Crawled Properties

CreatedBy

Text

Creator

Created

Date/Time

Office:12

Basic:15

DisplayTitle

Text

Basic:displaytitle

ModifiedBy

Text

ows_ModifiedBy

ows_Modified_0x0020_By

Contributor

Text

_Contributor

DisposalAction

Text

Disposal Action

ows_Disposal_x0020_Action

DisposalDate

Date/Time

ows_Disposal_x0020_Date

DisposalReview

Date/Time

Disposal Review

DocumentType

Text

Document Type

ows_Document_x0020_Type

Relation

Text

_Relation

Topic

Text

ows_Topic

Topic

CheckedOutTo

Text

ows_CheckoutUser

 

 

At this point it would be nice if they all just magically appeared in the advanced search dropdown list, but unfortunatley there’s one more step involving evil editing of config files.

 

Go into your Advanced Search page and select Site Actions – Edit Page. For the Advanced Search Box webpart chose Edit- Modify Shared Webpart. In the “Properties” section there is a ‘properties’ dialogue box which, if you click into it, will give you the […] ‘builder’ link allowing you to edit the XML string.

 

This string has four sections, two of which concern us. Between <LangDefs> and </LangDefs> it lists all the languages which can be used and between <Languages> and </Languages> it causes those languages to be displayed in the web part.

 

We’re interested in the bottom two sections however. Somewhere between <PropertyDefs> and </PropertyDefs> we need to insert all of the Managed Properties we added above, following the format of the entries already there. So, for example, for our “DisplayTitle” property, we add the line

 

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

 

Finally, in the section between <ResultTypes> and </ResultTypes> we need to show which result types we want our results to show up in. So assuming we want our new results to show up everywhere, we find the subsection between <ResultType DisplayName=”All Results” Name=”default”> and </ResultType> and add in the line

 

<PropertyRef  Name=”DisplayTitle” />

 

Exit the “modify web part” process and publish the page if necessary.

Comments

 

debs said:

I created a custom column in the document library, crawled the site & search it from the home page & i get the desired result as expected.

Now if I delete this custom column from my document library & crawl the site again I get the same result as before.

I opened the document & checked its  properties & found although the custom column was not there in Server properties it still persisted in the advanced properties (custom tab)section & hence the search result didnt change.

Now my query is how do I remove this custom column property from documents as & when I delete the custom column from doc lib.

July 31, 2007 4:37 AM
 

davsy said:

Is there any way to make the new site columns only visible when editing the page, not when the page is published for the general public?

January 8, 2008 1:44 PM
 

prasad said:

how do i configure the advance search webpart since no results are displaying when i am using this webpart.Do i need to do any configuration settings that my advance search web part works.At the same time my core seach webpart is working.

My requirenment is to configure the advance search webpart to a list where it could display the data based upon the metadata condion.

March 17, 2008 4:59 AM
 

asoundmind said:

I can't find this link

Central Admin – Shared Services Administration – Metadata Poperty Mappings

April 2, 2008 12:03 AM
 

Tim said:

This doesn't work for yes/no (boolean) metadata.

See the post: forums.microsoft.com/.../ShowPost.aspx

Does anyone know a solution?

April 7, 2008 4:48 AM
 

DC said:

Hi,

    I have a question on the search function. I have a farm and 2 SQL DB (Prod & DR). When I switch the DB connection to the DR DB, the search function is not working. Does the search run at the DB level or idex server level?

   If it can only run at the DB level, how to point the search function to DR DB?

June 6, 2008 2:34 AM
 

Gary said:

Hi, do you know what the syntax is for the "Date and Time" data type when defining scope properties in the Advanced Search web part. Have tried "<PropertyDef Name="PublishingStartDate" DataType="date/time" DisplayName="Valid From"/>" and <PropertyDef Name="PublishingStartDate" DataType="date and time" DisplayName="Valid From"/> . Both give an error. Any help would be greatly appreciated.

Thanks

Gary

June 8, 2008 1:22 PM
 

jwang88 said:

Hi,

It may seem obvious, but what is the correct way to genereate the crawled properties?

Here are what I did. I added Custom Columns and Custom Content Types, and started a full crawl on the content source, but not able to see the expected crawled properties. Are there any steps missing?

Your help is much appreciated.

Thanks,

Jack

July 8, 2008 4:14 PM
 

Shahid said:

Jack, try uploading a document with the appropriate metadata your searching for and then run a full crawl.

August 11, 2008 3:55 PM
 

vrr said:

Hi i managed to introduce the custom property (rating) which was choice to appear in the advanced search property, now i type in good (which is one of the choice for my custom column) i expect it to show in the search result the folder in my document library which I have given the value Good for rating. But it doesn't. Any clue given will be appreciated

August 28, 2008 1:56 AM

Leave a Comment

(required )  
(optional )
(required )  
Add

Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts