I am working on a task that is very cumbersome. I have a document library that’s full of different types of documents. Within the document I using the following metadata columns: Title, Application, and Tags/Key Words.

The objective is to have a search box on my home page of my SharePoint site that will allow end-users to input a tag or key word inside the search box. From there the search box will search within the document library repository and return any documents that fit the search criteria. View the image below for the dataflow.

What ideas do I have?

Take the search box from the document library and place on the home page of the SharePoint page. Therefore, I know that it’s searching the document library. Problem: Not sure how to do this. I possibility would be to take the code from that search box and add it to the home page.

Create a wiki that will return the results from the document library. Problem: How would I get the results to end up on the wiki page.

Another issue that I would want the original document library to stay functional for administrators. The end-user would just see the search box and results.

Thanks in advance for your help!

enter image description here

2 Answers 2


You can make use of query string filtering.

  1. Create a new view for the document library and set filter to use {FilterQueryString} and apply necessary condition
  2. Create a new wiki page and then add the library webpart - Then set the view = new view create in step1 above
  3. In home page edit the page and add a new Script Editor WebPart and use

            var val = $('#searchLib').val();
            var targetPage = "http://web/site/searchresultpage.aspx?FilterQueryString=" + val;
            window.location.href = targetPage;
    <input type="text" id="searchLib" />
    <input type="button" value="Search" id="btnSearch" />

Another option would be to add a content query webpart in the page - edit webpart - click Change Query - set keyword filter as Query from the search box - give path:Your library path

Apply and save the page and try it out.

You could refer this blog article for more information on configuring the content query webpart: Configure Content Query Webpart

Edit: As Amal pointed out if you want all sorting capabalities, create a custom view, add it as a webpart on the page and use filter webparts. Filter Webparts

  • The only problem will be, we will loose the functionality of OOB filtering/sorting etc. Jan 16, 2015 at 16:02
  • Yes you would hence its an alternate approach (no code one) possibly not the best, again it depends on the scenario and requirement.
    – Manu
    Jan 16, 2015 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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