none
Excluding folder (names) from search results RRS feed

Answers

  • Yes, the property IsDocument seems to fit the bill.

    You could use a Fast Query Language (FQL) query when submitting your queries, using this syntax: and(searchterm,isdocument:true) to get only documents.

    More on FQL: http://msdn.microsoft.com/en-us/library/ff394606.aspx

    I am not sure if this is possible with the standard web parts, but I think you can fix this by overriding a method or two.

    With regards,

    Gunnar


    Gunnar Braaten - Search Consultant - Bouvet ASA - www.bouvet.no

    • Marked as answer by S h a n e Tuesday, June 28, 2011 1:31 PM
    • Unmarked as answer by S h a n e Wednesday, June 29, 2011 9:08 AM
    • Marked as answer by S h a n e Wednesday, June 29, 2011 1:50 PM
    Tuesday, June 28, 2011 1:10 PM

All replies

  • Hi Shane,

    I don't think this is possible with crawl rules. If you create an exclusion rule which matches folders, then you also prevent the crawler from entering that folder.

    However it is possible to solve this with a custom document processor stage, and then using a scope to filter away all folders.

    The crawled property: B725F130-47EF-101A-A5F1-02608C9EEBAC:#13:19, contains the file attributes of a crawled file. This is a bit wise integer. A folder has the value 16(0x10) (and a file has the value 32(0x20)).

    If you send this property into a custom stage you can check if the item is a folder by doing

    (propvalue & 0x10) == 0x10

    If this equals to true, then assign a value to a custom crawled property, which you map to a managed property. And this property you can use in a scope to filter away all folders. Something along the lines of: "isfolder:0".

    A bit cumbersome, but it should work. If someone has a better solution I'm all ears.

    A list of file related properties can be found at: http://msdn.microsoft.com/en-us/library/cc251929(PROT.10).aspx

    Regards,
    Mikael Svenson 


    Search Enthusiast - MCTS SharePoint/WCF4/ASP.Net4
    http://techmikael.blogspot.com/

    Friday, June 24, 2011 11:25 AM
  • Another option is to write your own BCS connector. MSDN has a ready to use sample at http://msdn.microsoft.com/en-us/library/ff625806.aspx. It will still index the folder, but you can filter out the folder from result by setting a custom security descriptor on the folder entity. For the file entities, you can use the ACL from the file system, like the sample code demonstrated.

    Not necessary a better option than what Mikeal suggested, nonetheless another option to consider.

    Ben

    Friday, June 24, 2011 1:37 PM
  • If it is not possible to exlude folders using the default file system crawler (I have not used it yet), then an alternative solution could be to create a Custom Indexing Connector as described here: http://msdn.microsoft.com/en-us/library/ff625806.aspx.

    You could then design it so that it does not pick up and send folders, but only files. I am not sure if it is very straight forward, because I think you have to avoid sending folders back at all.

    At the bottom of the above linked page there is a link to an example implementation of an example "MyFileConnector Custom Indexing Connector Sample". Maybe this can be a place to start.

    An alternative route for doing this on the Connector side would be to create a .NET Connectivity Assemblies and Web Service: http://msdn.microsoft.com/en-us/library/ff464398.aspx.

    Or maybe even create a Custom Business Connectivity Services Connectors Using SharePoint Server 2010: http://msdn.microsoft.com/en-us/library/ff953161.aspx. This last method will probably demand more code, but will also give you more detailed control of how the connector behaves.

    Best regards Gunnar


    Gunnar Braaten - Search Consultant - Bouvet ASA - www.bouvet.no

    Friday, June 24, 2011 1:49 PM
  • Sharepoint clearly knows that a folder is a folder when representing it in the results list by using the folder icon. This leads me to think that there must be a property which specifies this. Is it therefore possible to append to all user queries the syntax (whatever it is) to exclude folders from the results?

    Thanks, Shane

    Tuesday, June 28, 2011 12:30 PM
  • Yes, the property IsDocument seems to fit the bill.

    You could use a Fast Query Language (FQL) query when submitting your queries, using this syntax: and(searchterm,isdocument:true) to get only documents.

    More on FQL: http://msdn.microsoft.com/en-us/library/ff394606.aspx

    I am not sure if this is possible with the standard web parts, but I think you can fix this by overriding a method or two.

    With regards,

    Gunnar


    Gunnar Braaten - Search Consultant - Bouvet ASA - www.bouvet.no

    • Marked as answer by S h a n e Tuesday, June 28, 2011 1:31 PM
    • Unmarked as answer by S h a n e Wednesday, June 29, 2011 9:08 AM
    • Marked as answer by S h a n e Wednesday, June 29, 2011 1:50 PM
    Tuesday, June 28, 2011 1:10 PM
  • It could be useful, but it will omit any SharePoint list items, pages and folders as well. Not only file share folders.

    -m


    Search Enthusiast - MCTS SharePoint/WCF4/ASP.Net4
    http://techmikael.blogspot.com/
    Tuesday, June 28, 2011 1:47 PM
  • Hi Shane,

     

    there are three different approaches here, with various pros and cons. It would be great if you can mark one (or more) of them as "Answer", although none of them fit your bill 100%. I don't think we'll get much further on this, and it's nice for others looking at this question to understand there are answers (although not perfect, admittedly).

    Thanks


    Thomas Svensen | Microsoft Enterprise Search Practice
    Wednesday, June 29, 2011 1:47 PM
    Moderator