You manage several related WordPress sites/multisites, and wish to aggregate their search results in a single super search. Thankfully, you can achieve just that with WPSOLR’s cross-domain search.
You can read the general concepts of cross-domain search, aka federated search, on the knowledge base article How to consolidate the search from several domains. Also, you can ask questions and learn from others in our dedicated cross-domain search forum.
The general ideas are as follow:
- A search “network” share a single Elasticsearch/Solr index. In the index, a unique site id is tagging each network document.
- One can setup any site in the network, to retrieve only in its own tagged documents from the shared index. It’s called “local search” settings.
- One can setup any site in the network, to retrieve all documents from the shared index. It’s called “global search” settings.
Activate the cross-site add-on
Create the cross-site search index
A network of sites share a single index. The plugin will create this index as usual on your first site. Then reuse the exact same index settings on your other sites, so WPSOLR can reuse the same index.
Its schema is no different from any ordinary WPSOLR index schema. The only difference is that, during the indexing phase, each site will mark its documents with a specific tag.
Note that you can create several network indexes, to configure as many cross-domain searches among all your sites.
Configure a local site search
Select the cross-domain search type “local”. Configure your search, then index your documents.
Unfortunately, local suggestions cannot filter results by the current site id. They are therefore deactivated. It is a limitation of Elasticsearch and Solr.
But you can select your own theme search template to display the local search results.
Configure a global site search
Select the multi domain search type “global”. Configure your search, then index your documents.
Global suggestions will work, because they do not need to be filtered by the current site id.
You can only select the default WPSOLR Ajax search template to display the global search results. Because only this template is designed to show urls of post ids belonging to other sites from the current network.
Cross domain search search does not support:
– Suggestions in local site searches, because suggestions cannot be filtered by the site id.
– The current theme search.php template with global searches. Only the shortcode Ajax template. Because search.php is not meant to build and display urls for post ids existing in other sites.