Share via

Advanced Searcher into multiple libraries SP On-Premise

Charlie Martharper 385 Reputation points
2026-01-26T08:08:27.5233333+00:00

Hi guys!

So I created multiple libraries in a Main page in SharePoint On-Premise, instead of only one.

I have a Searcher

User's image

Right now it was looking on 1 library:

User's image

Now I need to look at 4 different libraries the same searcher, is it possible? How could I do it?

Microsoft 365 and Office | SharePoint Server | Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Steven-N 21,165 Reputation points Microsoft External Staff Moderator
    2026-01-26T10:24:13.1733333+00:00

    Hi Charlie Martharper

    Thank you for reaching out to Microsoft Q&A forum

    As far as I know, in SharePoint On-Premises, a “searcher” (Search Results / Content Search / modern search results web part) typically uses a query template that is currently scoped to a single document library (for example, using a Path:"…/LibraryName" restriction).

    That said, there is possibility that after you created additional libraries, the same search box will still only return results from the original library until you update the query to include all required library locations (or switch to a Result Source that already scopes to them). If the query syntax is not valid (often due to incorrect Path formatting or encoding), the Search REST call can fail and surface a generic 500 “unknown error.”

    In this situation based on your requirement, I suggest that you can try the first 2 options below to see if it can help you:

    Option 1: Use KQL with multiple Path

    If your “Searcher” is using SharePoint Search with a Query template, update the query template to:

    {searchTerms} AND (
      Path:"https://yourserver/sites/yoursite/Library1"
      OR Path:"https://yourserver/sites/yoursite/Library2"
      OR Path:"https://yourserver/sites/yoursite/Library3"
      OR Path:"https://yourserver/sites/yoursite/Library4"
    )
    

    Option 2: Create a custom Result Source that targets the 4 libraries

    Based on my research, SharePoint Search supports building queries and scoping them via Result Sources (SSA / Site Collection / Site), then selecting that source in your search web part. You can check the instruction at Microsoft’s search query guidance explicitly covers using Result Sources and query transformation.

    You can try the above workaround method, if the problem still persists, kindly let me know in the comments for further support.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".     

    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' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.