I have created the Search Service Application and my Search is working fine. But my current requirement is I need to search for documents within a specific Document Library. Currently my search result page shows all the results from the whole site. My requirement is to show a documents from a single document library. How can I achieve this.

up vote 5 down vote accepted

Create a search scope and give URL for your specific document library only in the rule.

For details please check this link.

Help Link

Update: For SharePoint 2013 you need to create a Results Source and configure query to search in particular library only and configure your Search Results WebPart to use your Results Source.

Please check this link

  • Thanks Varun. But I am using Sharepoint 2013. So is there anything for Sharepoint 2013 for a specific document library. – Sushri Aug 6 '14 at 10:21
  • See my Updated Answer – Varun Verma Aug 6 '14 at 10:28
  • Please mark it as answer if it solves your query – Varun Verma Aug 6 '14 at 10:40

In addition to creating a result source (search scope), you can also simply provide the relevant query text directly in the search result web part of your search page. (See below).

NOTE: Be sure to include quotation marks around the URL path, I could not get it work otherwise.

{searchboxquery} path:"https://siteURL.com/DocumentLibraryName/*" 

For multiple locations, simply add them with a space delimiter.

{searchboxquery} path:"https://siteURL.com/DocumentLibrary1/*" path:"https://siteURL/DocumentLibrary2/*" path:"https://siteURL/DocumentLibrary2/*"

enter image description here

  • 1
    This is a much better answer – Kevin Stone Feb 7 '17 at 17:33
  • Can we query for specific folder in a Document Library ?? – Yayati Mar 17 '17 at 7:49

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.