Search scope a particular folder in library

Tanmoy Das 806 Reputation points
2021-06-07T01:37:00.44+00:00

Hi,

Can I set a particular folder in Pages and Doc library as my search scope in SharePoint 2013

Thanks

Microsoft 365 and Office SharePoint Server For business
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Allen Xu_MSFT 13,861 Reputation points
    2021-06-07T08:14:05.6+00:00

    Hi anonymous user ,

    Do you want to search all files under a specific folder?

    If you use contenttype:folder title:YourFolderName to search, it only returns the folder instead of files under the folder.

    The OOB way to achieve your requirement may be a kind of complicated. You can create a Result Source which contains all paths of the files in the folder. The way may be a little complicated since KQL queries don’t support suffix matching, so you can’t configure Path=http://*/FolderName in Query text to search items under “FolderName” folder. You need to type all paths of files like below. Or you can achieve it by coding.
    102886-image.png

    You can retrieve the paths of files by searching files before configuring the result source.
    102963-image.png
    How to configure the Search Results Web Part to use a new result source in SharePoint 2013 for your reference:
    http://blogs.technet.com/b/tothesharepoint/archive/2013/11/06/how-to-configure-the-search-results-web-part-to-use-a-new-result-source-in-sharepoint-2013.aspx


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.