I'm using a KeywordQuery within a custom Webpart on a SP2010 farm to aggregate the latest "documents" from the site collection the webpart is running at ("document" = every item stored in a document library except the folders).

Within the QueryString I limit the results to contentclass:STS_ListItem_DocumentLibrary, but folders are still present in the search results.

I’ve tried using IsDocument:1 but then the results are too limited, because there are some file types not registered in the Search Service Application file type pool, e.g. "RTF", "RAR", "PNG", ...

Do I really have to register every file type within the SSA to expand IsDocument or are there other ways to exclude the folders from the results?

  • have you provide RowLimit of your keyword query to extend search result ? Dec 19, 2013 at 13:54
  • I'm not sure if I understand you correctly: I've set RowLimit to 10 as I only want to receive a fixed number of results, e.g. "the ten latest (last modified) items from all document libraries". So it's more of a filter as an expand of the result.
    – jcp
    Dec 19, 2013 at 14:10
  • plz visit answer section of this post sharepoint.stackexchange.com/questions/60676/… Dec 19, 2013 at 14:16
  • I'm sorry, but I don't get you. Maybe I should have been more precisely: I know how to use KeywordQuery and KQL in C# code and I want to reuse the webpart on multiple sites. So a search scope as described in that other post won't fit my needs to exclude folders from the search result, would it?
    – jcp
    Dec 19, 2013 at 14:31

1 Answer 1


To exclude the Folders try adding "Size>0" to your query and see if that helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.