Forum Discussion
How do I provide search of a specific document library on my content page?
I have a page with web parts that provide various views of a document library. I would also like to provide a means of searching the document library. I thought I could put a Search Box web part and a Search Results web part on the page and configure the Search Box to just search the specific document library. But, I can't seem to configure the Search Box to narrow the scope. I am in Classic mode
I have been doing some research and it seems that I may need to use a Content Editor web part and JavaScript to achieve my goal. If this is the case, I really need help because I am not a programmer.
Any suggestions on how I provide a search box of the document library with results on the content page?
Thanks.
4 Replies
Hello Vanessa Martin9
you need to configure your results web part with a specific path for your results. In the query, also in classic, you can add a search results and change the query like this:
The current path:
{searchboxquery} Path:{site.url}
Or a specific path and only documents:
{searchboxquery} Path:"https://TENANT.sharepoint.com/sites/SPOClassicEnterpriseWiki/Documents/" IsDocument:1
Regards, Dave
- Kim WilliamsBrass Contributor
DaveMehr365 Can you have more than one library to search against?
- michalkornetIron Contributor
Kim WilliamsHi, you can try this query to search against more document libraries
(Path:"https://<tenant>sharepoint.com/sites/<site1>/<Document Library>" OR Path: "https://<tenant>.sharepoint.com/sites/<site2>/<Document Library>") IsDocument:1