0

How to exclude a site from search result source but keep its subsites in search results? I have a site collection in which i used to make team sites and project sites. In search results i want that all the subsites in that site collection should appear but that site collection needs to be excluded from search results. I tried the query as

-Path:siteurl 

But this query excludes all the subsites of that site collection. Please help?

  • Are you on-prem or SPO? Although I would not recommend having a "secure root site" with public sites below it, have you tried just adding security to the root and opening up the sub sites? – Matthew McDermott Jun 29 '18 at 13:40
  • I'm on on-prem currently. Actually i have created a site and named it to "teamsite" and in that site i allow users to create sites. Also i want to show the users all the teamsites created in a page so i created a result source for that. But that root site ("teamsite") is coming in results. – Sahil Jhamb Jul 2 '18 at 8:46
1

Could it be an option just to exclude the lists on the root site from search (list settings - > advanced settings)?

0

Yes, i got that hint from excluding lists from search and found that if i want to exclude a site then i need to go to Site Settings > Search > Search and offline availability and settings, then setting the "Allow this site to appear in search results?" option to "No".

0

Really late answer, I know! But in my case this query string worked:

contentclass:STS_Web path:http://sitecolname/* Site<>{Site.URL}

First statement gives you only webs in your result, path parameter searches for all webs and subwebs in the defined path. The last statement excludes the current site from your results. And there you have it. Off course this only works while using the search result web part on the current site collection.

You could also use "SiteTitle<>[SiteColName]" but that really requires a static site collection name that does not change.

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.