SOLVED

Limit SharePoint Search to current Site

Brass Contributor

Good Morning:

I am looking to create a Knowledge base type of site, where the search only brings results from that KB Site.

Be it using the Pnp Search tools, or the normal search box at the top of the site, how can i limit the search? i tried a few things, but so far, i alway get results from all the sites I am a member.

 

thank you

 

6 Replies
best response confirmed by MVCuser (Brass Contributor)
Solution

Hello @MVCuser

 

when you use the PnP Modern Search Web Parts https://microsoft-search.github.io/pnp-modern-search/ you can define the Path:"" into your query. 

 

Like:

Path:"https://TENANT.sharepoint.com/sites/MSTEvents/"

 

This query show's only results from the site MSFEvents. 

 

Hope this helps.

 

Regards, Dave 

Fantastic thank you David. Do you know when it comes to Filters: i created a column that has some choices. I try to use that as a filter but it is not showing me that column. Do you know what thaat might be (the column is a site column with many choices, i wanted to use those choices as filters)
Thanks

Hello @MVCuser 

 

yes, i think you need to configure managed properties:

https://microsoft-search.github.io/pnp-modern-search/scenarios/set-up-managed-properties/

 

Please attention, this can takes several hours.

 

And then you can configure your filters:

https://microsoft-search.github.io/pnp-modern-search/scenarios/page-with-filters/

 

Happy search ;)

 

Regards, Dave

Hi, thank you for your quick reply.
yes, i've seen that doc before and followed the steps (Site Column, content type) but yet i don't get to see the Managed Property when searching for it (and it's been a few days already) :(

Hello @MVCuser

 

you're welcome ;)

 

Have you add content to your columns? Map your properties to default RefinableStringXX . 

 

So as last you can try to reindex your site or library:

https://docs.microsoft.com/en-us/sharepoint/crawl-site-content

 

Regards, Dave 

Yes, I added content, Mapped it to RefinableString01 and still not showing as a filter option on the Search filter part (i did that yesterday, was hoping today i was going to see it but nothin) :(
1 best response

Accepted Solutions
best response confirmed by MVCuser (Brass Contributor)
Solution

Hello @MVCuser

 

when you use the PnP Modern Search Web Parts https://microsoft-search.github.io/pnp-modern-search/ you can define the Path:"" into your query. 

 

Like:

Path:"https://TENANT.sharepoint.com/sites/MSTEvents/"

 

This query show's only results from the site MSFEvents. 

 

Hope this helps.

 

Regards, Dave 

View solution in original post