How to search document from only one document library in SharePoint 2013.

  • I have a sitecollection that contains many document library, each document library contains conversion documents that filed to a site in another sitecollection - called "SearchDocument". all document library related to a site in "SearchDocument". in my sitecollection "SearchDocument" there is a web site contains many field for sort the displayed document. one of the sort field named "site" used to sort documents by the site they saved to. my requiered is: when the user insert a site in the "site" sort field, add to my scope query results all the document that saved in the match document librar – Efrat Jun 20 '17 at 12:31
  • We have converted your answer to comment. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review – Mohamed El-Qassas MVP Jun 20 '17 at 13:03

Filter on the Path managed property. For example, if your list is located at http://yourwebapp/yoursite/yourweb/lists/yourlistthen your search would be Path:http://yourwebapp/yoursite/yourweb/lists/yourlist*

Also, if you are using a certain content type in the list, you can use the content type filter. For example, ContentType:yourcontenttypename

Edit: You could also use the ListId managed property which is auto-populated. You can get the list GUID for the document library by going to the document library settings page and getting the id from the URL (it looks like something like feff2548-dd30-4372-80d1-c20a1a14b710) then your query would be ListId:feff2548-dd30-4372-80d1-c20a1a14b710

Just an FYI that in O365 SharePoint, I can only get the Path managed property to filter properly when I include the URL only in quotation marks. (See below).

This works:

path:"https://domain.sharepoint.com/DocumentLibraryName/*" 

But this does not:

 path:https://domain.sharepoint.com/DocumentLibraryName/* 

And neither does this:

"path:https://domain.sharepoint.com/DocumentLibraryName/*" 

I have not tested this criteria in an on-prem environment.

  1. Add Content Search webpart to page and edit the web part properties
  2. Click on Change Query - This will open the query builder modal dialog
  3. In order to display the documents from a specific library - Enter the list URL in the Restrict app section
  4. Click OK and Save the page

You can use the "path" restrictor. So in the search box you could put something like this:

terms to search for path:http://SERVER.com/SITE/LIBRAY

The "path:http://SERVER.com/SITE/LIBRAY" part of the query tells the search engine to look for the search terms only under the path given, and any of its children.

Or

you could define a custom result source (search scope) to limit queries to this library and then have a custom page to render those results. Check this post for info on that: http://sharepointbrandon.com/2013/07/setup-multiple-search-pages-result-sources-search-scopes-for-a-site-search-in-sharepoint-2013/

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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