I'm developing a custom webpart that displays all site collections the current user has access to. I'm using search with a KeywordQuery (contentclass:STS_Site) to bring up the results.
Now I want to exclude some site collections from the results for this webpart, e.g. all MySites. But these sites should not be excluded from the search index in general.
I've been testing a QueryString like this successfully:
contentclass:STS_Site \ NOT Site:http://UrlOfMySiteWebApp \ NOT Site:http://sharepoint/sites/SpecialPage \ NOT Site:http://sharepoint/sites/AnotherSpecialPage
But that may end up in a huge QueryString difficult to maintain. Altough I'm probably not going to hit MaxKeywordQueryTextLength.
Is there another (somewhat "more elegant") way to exclude URLs or entire web applications from a certain query / search result?