Quick Tip: Use “IsDocument:1” to Trim Search Results

Update 11/03/08: Fellow MVP Mike Walsh correctly points out that this is a WSS 3.0 / MOSS feature.  It does not work in WSS 2.0 or earlier.

Updatte 11/03/08: (Second update in one day!): Be sure to read the excellent comment from "nowise" for more info and another good xref link.

Two questions came up in rapid succession this week on the MSDN forums asking a variation of this:

"When I search a keyword, folders from my document library with that keyword in their path will come out first in my search results. I don’t want that to happen. Files with that keyword are more important to me.  I don’t want to see folders at all."

This is actually quite easy to do out of the box.  Simply add a "IsDocument:1" to the search query and SharePoint search (both WSS and MOSS) will restrict itself to showing actual documents.


Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

Technorati Tags:

4 thoughts on “Quick Tip: Use “IsDocument:1” to Trim Search Results

  1. Paul Galvin

    Sandeep, You probably figured this out weeks ago, here goes anyway…

    You don’t need to do anything special to enable security trimming. WSS 3.0 and MOSS (any flavor) has security trimming built in and in fact, it cannot be turned off.

    As for the scope question, I don’t know. What you did sounds right ot me.

  2. Sandeep Abhyankar

    my actual requirement is that when a user searches with a keyword, the search results should contain content to which the user has access to. how do i enable this ‘security trim search results in moss’ ? or is it enabled by default?

  3. Sandeep Abhyankar

    Hi Paul. i was looking for this for a long time. I have a question. I am the admin for sharepoint site. Where do i add IsDocument:1 in sharepoint search? how do i get there? Also how do i change the query?
    iIenabled IsDocument to ‘Allow this property to be used in scopes’ from Shared Services Administration: SharedServices3 > Search Settings > Managed Properties and in Scopes, i added the rule IsDocument=1 for Property query.
    When i run the crawler, the ‘Item count’ for this rule in the scope says ‘error’. Where am i going wrong?

  4. nowisee wrote:

    You can also add contentclass to the search query. If you want to only search documents in document library’s you add "IsDocument:1 ContentClass:STS_ListItem_DocumentLibrary" to the search query. This can be used to avoid getting hits on aspx pages and other non document library items.

    For a complete list of ContentClasses check Mark Anderson’s Blog


Leave a Reply

Your email address will not be published. Required fields are marked *