DCSIMG
Searching Content Types in MOSS 2007 - itaysk

Searching Content Types in MOSS 2007

Posted Tuesday, February 05, 2008 6:49 PM by Itay Shakury

If you ever tried to use SharePoint's Content Types with search, you'll find it simply doesn't work. This article tries to help you overcome this issue.

In the following article

  • I use the term 'IMT' to address the Internet Media Type (AKA MIME type) of the file (text/plain, application/vnd.ms-word, image/gif, etc...).
  • I use the term 'SP Content Type' for a SharePoint content type (Item, Event, Document, etc...).
  • I use the MOSS Query Tool to quickly execute search queries against MOSS.

Example:
We have created a SP Content Type called 'Article'. We then want to search our site for all documents of the 'Article' content type. We find no results.

Problem:
BeforeCT

As we can see at picture above, the built-in managed property 'ContentType' usually  gets populated with values that represents the Internet Media Type of the file, instead of the desirable SharePoint Content type.

Cause:
If we take a look at the built-in 'ContentType' managed property, we find out that it first gets the IMT of the file, and only then the SP CT of the file. In this case, the SP CT will be picked into the property only if there is not an IMT for the file.

We also find out that unlike any other managed properties, we can't edit the crawled properties here, nor change the order they are picked.

ContentTypeManagedprop

Solution:
Create a new managed property, that contains the same properties, but in the opposite order. This way, the gatherer will first look for a SP CT, and only if it doesn't exists, it will pick the IMT of the file.

1. Go to SSP Management --> Search settings --> Metadata property mappings --> New managed property.

2. Type a name in the 'Property name' field.

3. Select the second radio button - 'Include values from a single crawled property based on the order specified'.

4. Click the 'Add mapping' button.

NewManagedProperty (Click to enlarge)

4. Search for and add the property 'ows_ContentType' (under the 'SharePoint' category)

CTCrawledproperty (Click to enlarge)

5. Search for and add the property 'Basic:5' (under the 'basic' category)

6. Click on 'OK'

7. Recrawl your content.

Result: 
You have a managed property that contains the SharePoint Content Type of items. You can use this managed property in search.

BeforeAndAfterCT

Comments

# re: Searching Content Types in MOSS 2007

Monday, April 28, 2008 6:37 PM by Corey Dutson

I'd like to point out that at least in my install of SharePoint, I have 3 "Basic:5" items, in which case how do you choose which one?

# re: Searching Content Types in MOSS 2007

Wednesday, November 19, 2008 5:52 PM by Steve

yah, what's the "Basic:5(text)" mean?

# re: Searching Content Types in MOSS 2007

Monday, April 20, 2009 1:41 PM by vapcoder

@Corey Dutson: Look in crawled proprty List->Basic which property is mapped to original ContentType

# re: Searching Content Types in MOSS 2007

Monday, May 18, 2009 9:59 AM by nick_baschi

# re: Searching Content Types in MOSS 2007

Wednesday, October 28, 2009 10:38 PM by omar

can you please tell me after creating a blog site i have this list where I can manage posts and create new posts.

how can I find out which content type is being used for this list . Name it shows is NEW ITEM , i cant find it any where in galleries

thanks in advance

# Sites « Dot Net Solutions

Monday, January 25, 2010 4:46 PM by Sites « Dot Net Solutions

Pingback from  Sites « Dot Net Solutions

# Quick Revisit to Custom Advanced Search Page

Tuesday, September 28, 2010 10:11 PM by Timlin Enterprises

Quick Revisit to Custom Advanced Search Page

# re: Searching Content Types in MOSS 2007

Friday, March 25, 2011 4:30 AM by Miguel

Muchas gracias fue de mucha ayuda gracias de verdad

# re: Searching Content Types in MOSS 2007

Wednesday, October 26, 2011 12:16 PM by Maria

So after I have done this how do I get the Content types to appear in a search drop down?

# re: Searching Content Types in MOSS 2007

Friday, November 25, 2011 11:19 AM by hari krishna

good article

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: