Tuesday, July 04, 2006

Found it! How to Add Properties To advanced Search in MOSS 2007

Amazing!!!
Microsoft went with a design that I actually planned to do in sps2003 and never got around to do. The settings for the advanced search are now in the web part it self and not in the properties. This allows for flexibility in a much bigger scale.

For this demo I have added a custom property called "branch" to the profile properties, and in the following walkthrough I will show how to add searching on that property to the advanced search screen of the people search.

Step 1 - Add a custom property to the profile database:


I find it neccesary to explain this, since the location for this was changed from sps2003.
To manage the properties in the profile database today, you need to go, not into the sharepoint portal site settings (where it used to be in the 2003 version) but into "sharepoint centeral administration" (from administrative tools) and there click the shared service link on the left. The profile management links are all there.
For the purpose of this demo I created a property called branch, of type "string" with "choice list" and added some options to the list. I hope tommorrow I will have time to post some images to make this explanation easier to understand.

Step 2 - change the advanced search:


Open the search page you want to edit the advanced search for (in this demo I used the people search page) and use the "Site Actions">"Edit page" menu to edit the page:

Open the menu for the search web part and select "Modify shared web part" to open the web part property pane:

Expand the "Miscellaneous" section in the properties pane and find the property called "properties":

Now, this is the nice part. This property contains an XML string that allows you to define what properties will be displayed in the advanced search. I advise you copy the string into an xml editor for better editing, or even just notepad.

Edit the XML string and save it back into the property. I added a line (last line in the following example, marked in green) to add the branch property I created, and the end result looks like this:

<Properties>
<Property Name="Department" ManagedName="Department" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:Department"/>
<Property Name="JobTitle" ManagedName="JobTitle" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:Title"/>
<Property Name="Responsibility" ManagedName="Responsibility" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-Responsibility"/>
<Property Name="Skills" ManagedName="Skills" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:SPS-Skills"/>
<Property Name="QuickLinks" ManagedName="QuickLinks" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:QuickLinks"/>
<Property Name="Branch" ManagedName="Branch" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:Branch"/>
</Properties>

After saving the property to the web part, publish the page, exit edit mode and switch to advanced search:

Notice how sharepoint sees that the branch property is a choice list property and automatically lets the user select from the list?

Liked it? please kick me: kick it on SharePointKicks.com

12 comments:

Anonymous said...

Is that all you need to do to make SP actually use it, or is it up to then only available in the menu

Ishai Sagi said...

thats all you need

Anonymous said...

great!!

Is this only for people search or can this be done for all sites tab too?

Ishai Sagi said...

this is for the advanced search web part in general - no limit to people search.

mahesh87 said...

I dont think this works for Document Library or Picture library. I did the same, but didnt work.

You will also need to do "document property mapping" with "crawled properties". This is available in the Shared Services under Search customization page.

I was able to get this working for some Lists but not for document libraries/picture libraries.

Is is possible to make it work?

Anonymous said...

mahesh, i think you need to map that property with the equivallent in the document library, (namespace microsoft:office:office), and you have to add that property to the index (yes, a managed property).

mferreira

Anonymous said...

Can multi-value properties be added ? If so, would I be able to select multiple values for the adv. search criteria ?

KC said...

I cant seem to get it working. I added a new custom property in Shared Services. I ensured that there are user profiles that have values for this property. I did a crawl in search settings. But when I tried to search with the advanced search options, no result was returned. Any idea why is this so?

PommieAL said...

This sounds ideal. We are looking at allowing more data to be searchable in people search and think this may answer that need. I have a question though. We import the user data from AD into the Sharepoint profile database. Is there a mapping table / document that identifies what AD fields to the fields in the profile database in Sharepoint? I want to enable things like "Office", "Manager", "Geographic data such as "State" etc.

Would I then be able to use the same steps detailed here to expose those fields to be searched?

Ishai Sagi [SharePoint MVP] said...

PommieAL - yes, you can go to the shared services and set up mapping for fields between sharepoint and AD. you then need to specify for fields you want to search on that they are indexable, and perform a full index (search settings) so that this is populated in the search index. Then you can add those properties to the advance search.

Ishai

Ganti said...

Hi,

I have tried adding properties to advaced search and it works for me. But the problem is, the new options are only displayed to the system account, while if a user from other account login to the site, the new properties are not visible. Could anyone tell me how to get it working.

Rajesh.

The BWB said...

I too has having difficulty getting this to work till I ran accross this post
http://www.sharepointblogs.com/aaronrh/archive/2007/05/21/adding-additional-properties-to-the-moss-people-search.aspx

there are several others steps involved - at least there was for me - since I wanted a property in the user profile - it needed to be mapped to the search but before that the search had to crawl and find it