Single Algolia index for Multisite installs

With the release of WP Search with Algolia Pro version 1.3.0, site owners now have the ability to push content from each site in the network into a single Algolia index. This type of functionality is useful if you’re perhaps wanting a global search of content from all sites in the network. This is particularly useful for Institutions or Universities where different departments all have their own sites.

With this documentation page, we want to outline important notes regarding this functionality.

For data safety sake, we recommend starting with a fresh index instead of one that has already existing content.

  1. WP Search with Algolia Pro needs to be network activated to enable the functionality
  2. It overrides and customizes the objectID property to include the site ID from the multisite network.
  3. Each site needs to be public to be considered and indexed. This would be the “Search engine visibility” setting from “Settings > Reading” in your site options area.
  4. Most of the settings pages will be moved from the individual sites’ admin areas, into the network admin.

Meta data

As part of the development of the network-wide indexing, we had need to also include the ability to specify comma-separated metadata keys, per-post type, to index. Thus there is a new setting page in each site to provide the list of keys to fetch and include the values from. There is also the ability to set some defaults at the network level.

Note: When meta fields are defined for an individual site, these settings will supersede any meta fields defined at the network level for the site in question.

Autocomplete

Because of the nature of this feature, Autocomplete is set up to be one, network-wide configuration. The configuration settings are filterable, using the `wpswa_pro_network_wide_autocomplete_config` filter. Below is the out-of-box settings for the Autocomplete configuration

[
	'admin_name'      => 'All posts',
	'index_id'        => 'searchable_posts', // E.g. 'searchable_posts'.
	'index_name'      => Utils::get_network_index_name_prefix() . 'searchable_posts', // E.g. "prefix_$index_id".
	'label'           => 'All posts',
	'max_suggestions' => 5,
	'position'        => 1,
	'tmpl_suggestion' => 'autocomplete-post-suggestion'
]

We recommend settings a prefix that will make it obvious that the index is the network-wide index.

Network status page

You will be able to access a status page for the site by visiting the Network Admin area. There you will be presented with:

  1. List of current sites, including site ID, name, path, and public visibility.
  2. Total indexable sites, the amount currently indexed, the amount not currently indexed, amount excluded, and batch data for the sites.

When the network indexing process is started, each site eligible for indexing will be processed one at a time. By default, up to 100 posts will be processed at a time. This process runs asynchronously to avoid timeouts, but indexing will be interrupted if the user navigates away from the page once the process is started.

If the indexing process is interrupted, the option to resume indexing will be available. When indexing is resumed, sites that have already been fully indexed under the current network batch will be skipped and the process will start from the last site that was not fully indexed. Note that partial site resuming is not supported, so if a site is only partially indexed when indexing is interrupted, it will be re-indexed in its entirety when resuming.

Indexing a single site within the network index

Individual sites can have their index rebuilt within the network index by visiting the Algolia Settings page for the site to be indexed. This operation is available to admin users, whereas the network-wide indexing settings are reserved for super admins.


Given the volume potentially being indexed, and due to a performance regression in WP Search with Algolia Free version 2.6.0, we recommend upgrading to version 2.6.1 or later.