If you worked with Sharepoint 2007 or 2010 you know that in most cases it is possible to fully automate provisioning and make it by scripts. However when you provision site collection in Sharepoint 2013 with cross-site publishing there are few additional steps which require full crawling and which are harder to automate. In this post I will describe the installation order for site collections with cross-site publishing.
Here are the basic steps:
1. Create new web applications in Central administration: authoring, publishing and probably assets.
2. Deploy custom wsps if needed. They may contain custom web templates used for creating sites.
3. Create site collections in the following order:
3.1. Assets site at first as it is the most simplest in most cases. It is used as storage for images, attachments, documents and other assets. Often standard site templates may be used for it;
3.2. Authoring site – it should go second because we need to crawl it in order to be able to connect to catalog in publishing site (see below). After site collection is created we need to configure search service application:
3.2.1. Create new content source in Central administration > Manage service applications > Search service application > Content sources. Also ensure that authoring site is not in Local SharePoint sites content source. It will allow us to make configuration more flexible and independent for authoring and publishing sites. E.g. can use incremental crawl for publishing site and continuous crawl for authoring.
3.2.2. If you need to exclude some parts from authoring site add appropriate crawl rules in Search service application page.
3.2.3. Important step: for each document library which is published as catalog we need to create some content and specify some values in all metadata fields for which we need to have managed properties in search index (and which then can be used in search queries). It is important to have not-empty values in all such fields, otherwise managed properties won’t be created.
3.2.4. Run full crawl for the authoring site content source.
3.2.5. After full crawl go to Search service application > Search index > Crawled properties and ensure that for each field in your custom content types (from document libraries which are published as catalogs) there are 2 crawled properties (see the following article which tells why 2 crawled properties are created for each metadata property: Problem with not crawled managed metadata fields in Sharepoint 2013).
3.2.6. For each crawled property configure managed property. It is possible to do it by PowerShell script: PowerShell script for creating and mapping managed properties in Search service application in Sharepoint.
3.2.7. Run full crawl again.
3.2.8. Enable continuous crawl if needed.
3.3. Publishing site. At this phase we made full crawl already and catalog connections should be available (in Site settings > Manage catalog connections. See also Restore Sharepoint site with configured cross-site publishing on different environment for details) so we may connect to them during provisioning of the publishing site. It can be done programmatically e.g. by using CatalogSubscriber from this msdn sample: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.publishing.catalogconnectionmanager.aspx.
Also if you need to configure managed properties also for publishing site make similar steps to those which were described for authoring site.
This installation order will help you if you will need to provision site collection in Sharepoint 2013 with cross site publishing. Hope that it will be useful.