One of the greatest things about eZ Publish as a CMS is its ability to host many websites (siteaccesses) in one eZ Publish install. Recently I had the privilege of working on an eZ install that hosted 4 websites, giving the illusion of a single site experience across multiple urls. We used eZ Find extensively, specifically its multi-core functionality, to get information across the sites with ease. That way, all the sites can keep and maintain their own databases, and what is shared is shared through Solr.

Solr Directory

So, to start. Let’s assume that if you are reading this, you already read through my previous eZ Find tutorial (Installing eZ Find). Since we already have our sever up and running there won’t be a lot of work to do there. But, we need to move our config files to the Solr multicore directory. Last time we used the Solr directory, this time we need to use the directory solr.multicore. Inside the multicore directory there are a couple of demo cores for languages. What I did is duplicated the english directory a couple times and renamed them for each site.

I think this is the time for a nice FYI. We can go about this next part in a couple of different ways. The way we choose depends on the desired consequence. So, ask yourself this question, ‘Do I want the siteaccesses to share content?’ If you answered yes, you only need 1 core for you sites to share off of, if you answered no, then create a core for each site that you wish to keep separate from the others. Another note, this effect can also be achieved by adjusting an ini setting, but if you know you want your stuff separate, then create multiple cores, it is safer that way. The way I set mine up is I have 2 cores. 1 core has 3 siteaccess sharing content, the other has just 1 site on it (that way its index content will not get mixed by accident).

Now that we are using Solr in a multi-core environment, starting Solr is a bit different.

java -Dsolr.solr.home=solr.multicore -jar start.jar

Notice, we just sent the start.jar a new place for solr to call its’ home directory solr.multicore.

Now that we have Solr re-configured for multi-core work we have to set up our solr.ini files. Inside the siteaccess specific override folders we need to drop in and edit a solr.ini.append.php file. Inside the ini file we need to point eZ Find at the right Solr cores.

[SolrBase]
SearchServerURI=http://localhost:8983/solr/<core-name>

With that one ini setting set we can fully update our index with the same command as before (the update script inside the eZ Fnd extension). So, after we have that set there is 1 last setting that we need to set, it is inside the ezfind.ini.

[SiteSettings]
#IndexPubliclyAvailable=disabled
#SearchOtherInstallations=disabled

Notice that I have the settings commented it out here. I set it in the siteaccess specific override files, and if it is not commented out it overrides my content. Remember, this setting only applies to content that shares a core, if the content is not sharing a core it will not be able to search the other installations.

With this simple set of settings, we gain a lot of power over search. Combinations work here as well, if you don’t want to share the index, but want to search other available indexes, go for it.

Best of luck to you, if I missed something don’t be afraid to let me know. Also, if you have questions be sure to ask.