0

Requirement is that people should be able to search only within the subfolder they are currently in.

I am on SharePoint 2013.

So far I managed to limit search results to only documents in my specific document library by using a result source. I also include the current Path my user is in in the GET-fields like so:

search.aspx?k=Outlook&currentPath=/03%20FORMS

The goal is now to only find results with "Outlook" inside the subfolder "03 FORMS" in my results, but it also shows everything else from that document library.

My Querystring is this: {SearchBoxQuery} Path:{QueryString.currentPath}

I noticed that when I use the test section from the query editor, it includes both the Path: from my query and from my result source.

Outlook Path:"/03 FORMS" Path:http://localSPServer/shared%20documents

Is it possible that the result source overrides the Path:-Part from my query? And is there a way to make them both apply? Or am I missing something entirely else?

1 Answer 1

0

What I ultimately did was using a script to filter out unwanted search results by going with the path that is below every result. Just made a list of search results and set the irrelevant ones to display:none. Additionally I used MutationObserver to check the Webpart for changes and hide everything unwanted when the Webpart reloads (different search term, switching pages etc.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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