Various MOSS Enterprise Search Stuff – Part I

Recently I have been working on a large Content Management solution that required 300+ custom Managed/Metadata Properties in MOSS Search and had requirements to allow user to search on all of the Metadata Properties. MOSS Search Index was also used to run a number of reports such as “What Asset (Image, Video, Document etc) is used on what page?”

While working with MOSS Search I came across a number of things that I think are worth sharing.

Programmatically setting up Shared Scope

APIs to work with MOSS Search related Administration tasks such as creating Scopes, Managed Properties etc are very straight forward and well documented under Getting Started with the Enterprise Search Administration Object Model

But if you want to set up a shared scope, then it’s not very obvious from API how to do it. ScopeCollection.Create method as shown below takes owningSiteUrl as a parameter and to set up a shared scope just pass in null for owningSiteUrl and the scope will be created as a Shared Scope!

public Scope Create (string name,string description, Uri owningSiteUrl,   bool displayInAdminUI,string alternateResultsPage,ScopeCompilationType compilationType)

Programmatically setting up “Include values from a single crawled property based on order specified”

Programmatically setting up mappings to crawled properties is straight forward, if you want to add multiple crawled properties and include value only from a single crawled property based on the order than from the UI, you can simply check the radio button next “Include values from a single crawled property based on order specified”.

Managed Properties Mappings

To do it programmatically add multiple Crawled properties to MappingCollection and then set ManagedProperty.RespectPriority property to true, here is some code (pseudo code really!) to add multiple crawled property mappings

Schema propertiesSchema = new Schema(SearchContext.Current);
ManagedPropertyCollection managedProperties = propertiesSchema.AllManagedProperties;
ManagedProperty managedProperty = managedProperties["Test Property"];
MappingCollection mappingCollection = managedProperty.GetMappings();//Create Crawled Property Mappings
Mapping propMapping = new Mapping(new Guid("00130329-0000-0130-c000-000000131346"),  "ows_Modified_x0020_By", "31",managedProperty.PID);
Mapping propMapping1 = new Mapping(new Guid("b725f130-47ef-101a-a5f1-02608c9eebac"), "11","31",managedProperty.PID);//Add in the order in which you want it to appear in the Admin UI


managedProperty.SetMappings(mappingCollection); // You have to do this for Mappings to work

//Tell it to respect priority!

managedProperty.RespectPriority = true;


It takes a Guid (crawledPropset) which is the category of crawled property (SharePoint, People, etc) and also takes an int (crawledPropertyVariantType) which represents the DataType of crawled property, I find it annoying that list of possible values crawledPropset and crawledPropertyVariantType is not very handy so here are the possible values

Some Possible Values of crawledPropertyVariantType

Data Type crawledPropertyVariantType
string 31
bool 11
integer 20
datetime 64
Something to do with Custom field 4127

*Please note that above values are what I have encountered till now *

Commonly Used crawledPropset

Category crawledPropset
Sharepoint 00130329-0000-0130-c000-000000131346
Basic 0b63e343-9ccc-11d0-bcdb-00805fccce04
Mail aa568eec-e0e5-11cf-8fda-00aa00a14f93
Office f29f85e0-4ff9-1068-ab91-08002b27b3d9
People 00110329-0000-0110-c000-000000111146

2 thoughts on “Various MOSS Enterprise Search Stuff – Part I

  1. Hello just wanted to give you a brief heads up and let you know a few of the pictures aren’t loading properly.

    I’m not sure why but I think its a linking issue. I’ve tried it in two different browsers and both show the same

    • Thanks, It seems to be loading on my iPhone, are you on a corporate network and may be its blocking domain which is where the images are hosted? I have noticed similar blocking somewhere else also

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s