philipsh

Hi,

I'm trying to set up my MOSS 2007 portal so users can search items by the item's content type. I found a few links (listed below) that tallk about this and I followed their instructions but my queries are pulling back too many items. They pull back items that are not of the specified content type but contain the content type's name. For example, a keyword search such as "ContentTypeBig Smileocument" will return all items of content type "Document" but it also returns all items with the word "Document" in them (even if they are not of content type "Document"). This is obviously not what we want.

As per the instructions in the links below I modified the "Properties" XML of the advanced search web part so "ContentType" could be choosen in the Advanced Search property picker. ("ContentType" does exist as a Managed Property on my site and it is mapped to the crawled properties "Basic:5(text)" and "ows_ContentType(text)" ). I made another managed property and mapped it to just the "ows_ContentType(text)" crawled property but the search results where the same.


Any help would be much appreciated. Thanks,
Phil


Here are a few links that reference searching on content types and adding managed properties to advanced search:
http://sjoere.blogspot.com/2007/04/use-content-type-for-search-scope.html

http://souls-end.spaces.live.com/blog/cns!AEC42F315B4528B0!2669.entry

http://www.sharepointblogs.com/aaronrh/archive/2007/03/28/excluding-content-types-from-search-results.aspx

Customizing and Extending the Microsoft Office SharePoint 2007 Search
http://msdn2.microsoft.com/en-us/library/bb608302.aspx

Creating and Exposing Managed Properties in the Advanced Search Page of SharePoint Server Enterprise Search
http://msdn2.microsoft.com/en-us/library/bb428648.aspx



Re: SharePoint - Search Search by content type returning incorrect results.

mc9999

When I run into that scenario, I put quotes around the critria portion so that it only returns exact matches.

ManagedProperty:"criteria"






Re: SharePoint - Search Search by content type returning incorrect results.

philipsh

Tried it but get same result. Also, same results in the Advanced Search web part if I pick "ContentType" and set the equation to "Equals" (exact match right ) and the value to Document in the property picker ( with no other information specified). Still returns non-document content types.





Re: SharePoint - Search Search by content type returning incorrect results.

smc750

I do believe the keywordquery will search content automatically. Try "ContentTypeBig Smileocument -document"

Basically exclude documents that have the word "document" in the content.






Re: SharePoint - Search Search by content type returning incorrect results.

philipsh

smc750, you're excluding based on item content. We want to filter only on the item's content type. Regardless of what the item contains isn't there a way to search only on the item's content type





Re: SharePoint - Search Search by content type returning incorrect results.

smc750

I am not sure if you can get the advanced search webpart to do full text sql queries. However, using the FullTextSqlQuery class you can execute queries strictly on properties. SELECT Path, Title, ContentType FROM SCOPE() WHERE ContentType = 'Document'