2
votes

I want to build a sharepoint online search result source that includes only some site collections and subsites. I have over 5000 Site collections, so I can't use named URLs/site ids in the result source - not maintainable. Instead I hope to add an indexed property to a site's property bag after site is provisioned then map a managed property to it, and use it in a resultsource to filter search results to match only content found in sites that have that property value. The Phil Harding's article describes the approach: https://platinumdogs.me/2015/02/06/set-a-propertybag-property-as-indexed-queryable-via-search-using-csom-powershell/ and Mike Morawski adds some code for the indexed property encoding - http://www.migee.com/2015/09/14/allowing-property-bag-values-to-be-searched-via-sharepoint-search/ I used bits of both to implement this approach.

Approach:

  1. Add Key = 'SiteType', Value = 'MySiteType' to Web All Properties
  2. Add Indexed Property 'SiteType' with 'MySiteType' Value to web IndexedProperties (vti_indexedpropertykeys). Key encoded to base64
  3. Add Managed Property 'propSiteType' mapped to 'SiteType' Crawled property in Search Schema manually.

I've done 1 and 2 via Powershell+CSOM, and verify site property added and is crawled. Managed Property is there, but It is not available in ResultSource builder dialog, and any searches such as {searchterms} propSiteType:MySiteType or (contentclass:STS_Web OR contentclass:STS_Site) propSiteType:MySiteType do not return results.

Ideas or alternative approaches? Thanks in advance

1
Not sure why someone down-voted this. I canceled out his/her vote. It is a complex subject, but the question is clear for those knowledgeable in this area and it includes references that discuss the solution that is not working for you (for some reason). - Kirk Liemohn
@KirkLiemohn - Ditto. I really, really, really hope SO starts requiring comments for down votes. - Tracy
Your site index property will be crawled (confirm by looking at the search crawled properties), however there will need to be a Managed Property (Search Schema) that is Query-able for you to query on it. With SharePoint Online, the best I could do is to map the newly crawled property propSiteType to a RefinableString..., then you'll be able to query/filter on the RefinableString.... - Tinminator

1 Answers

2
votes

My only thought is an indexing delay. I have seen O365 take days to index new content, and that's even when manually requesting a crawl. If that was the issue, it's probably resolved by now. Are you seeing relevant search results?

https://www.sharepointnutsandbolts.com/2013/10/waiting-for-search-crawl-in-office-365.html