The actual setup is described in the guide Cross-domain search.
Let’s imagine you manage several newspapers, or blogs, or magazines. Let say that one site is about cooking, one is about fashion, and the last one is about quantum physics (geeks can be hip also).
Now, you would like to search in all your sites, and show all the results in one consolidated site, let say the newspapers site.
There is one option in wpsolr, just to do that. Define, for each site, if it belongs to a network, and if it is a local search site, or a global search site.
How does that work ?
Remember first that wpsolr search is powered by Solr indexes. Now, what if all sites in a network could share that index, but be able to filter out their own results (local search site), or not (global search site).
Well, that is exactly what wpsolr does!
Simple enough, then:
- For all the sites of the network, use the same Solr index configuration in wpsolr’s index definitions.
- For each site showing their own results only (the blog and magazine), select wpsolr option ‘Local search’
- For each site showing results from the whole network sites (the newspaper), including all local sites and their own results, select wpsolr option ‘Global search’
Can we define several networks?
Yes, we can. Just repeat the same setup, but with a different Solr index for each network.
Can we define networks with multi-language sites?
Yes, we can, with wpsolr multilingual packs (wpml, polylang). Just share one index by language on the network.
For instance, if all my sites are written in English, and French, I will use 2 Solr indexes for the whole network, and share them on each site.
You can also have the German language on the magazine site. In that case, you need to add German to your global site also (global sites must have all languages of the network installed).
Does it work in a WordPress multisite network installation ?
Yes, it does.
Does it work in a non WordPress multisite network installation ?
Yes, it does. Your sites does not need to be related.
Cross-domain search does not support:
– The current theme search.php template. Only the shortcode Ajax template.