The other day a client tells me that he wants to limit the results of their SharePoint, but it was a bit different that I was used to.
In this case, they have a webapp where are different site collections, but few weeks ago I created a new site collection to integrate SharePoint with Navision. My client wanted the search results from Navision separated from the general Search results.
So I decided to do the following:
To exclude the Navision results from the main searchcenter, I edit the SearchResults webpart, and in the querybox I type the following:
By doing this, I’m excluding the Navision search results from the main search center.
But wait, you’ll thinking, and what happen with the search results from the Navision site collection?
In this case we want to limítate the search results to only this site collection, so we have to create a result source to achieve this.
Navigate to your SSA on Central Admin and click Result Sources in the left hand menu.
Next click “New Result Source”. This would be equal to a new search scope. Give the result source a name, leave the radio button on “Local SharePoint” as we’re searching local content. The limiting rule is then added in the Query Transform box. You can either launch the Query Builder or manually append your limiting query to the user query.
In this sample you will end up with the query:
Finally you will save the newly created Result Source.
Now that you have create the Result Source (or scope) you need to configure your search page to use it. Navigate to your search result page and enter edit mode. Next edit the Search Results Web Part and click the Change query button.
Click OK, save your page, wait a few seconds for the change to be picked up and results should be limited to http://myappweb/navision.