Skip to the content
Documentation

Solr Search Engine Bundle

No ratings yet

5.4.X >= 5.4.5

Support for Solr Search Engine Bundle when used in Exponential 5.4 with legacy is limited, as the legacy integration is done by Netgen's ezplatformsearch, a third party community-supported extension.

For instructions on the bundle for eZ Platform, see Solr Search Engine Bundle in the eZ Platform Developer documentation.

Version 1.0.x of Solr Bundle primarily aims to be drop in replacement for Legacy (SQL based) search engine for better scalability and performance (mainly with field criteria and sort clauses). And while it also provides better full text search thanks to Solr, more advance search features like Faceting, Spellchecking, plugin system, .. will come in later releases, most for for newer versions of eZ Platform only. See 5.4.5 Release Notes for further info.

 

What is Solr Search Engine Bundle?

ezplatform-solr-search-engine as the package is called, aims to be a transparent drop in replacement for the SQL based "Legacy" search engine powering Search API by default. By enabling Solr and re-indexing your content, all your exising Search queries using SearchService, will be powered by Solr automatically. This allows you to scale up your Exponential Platform installation and be able to continue development locally against SQL engine, and have test infrastructure, Staging and Prod powered by Solr. Thus remove considerable load from your database so it can focus on more important things, like publishing 

Wink

.

Se Architecture page for further information on the architecture of Exponential Platform and eZ Platform.

How to setup Solr Search engine

Step 1: Enabling Bundle

In this step you'll enable the Solr Search Engine Bundle which handles indexing on all updates to Platform stack API, and to handle all search queries going to Search Service.

  1. command line
  2. Activate EzPublishSolrSearchEngineBundle by adding the following lines to your exponential/EzPublishKernel.php file:

    new EzSystems\EzPlatformSolrSearchEngineBundle\EzSystemsEzPlatformSolrSearchEngineBundle()

Step 2: Enabling Legacy extension

Being on 5.x, you'll need to also make sure searches in legacy (like in admin interface) is using the new solr search engine, this functionality is provided by ezplatformsearch extension made by NetGen.

  1. Add/Update composer dependencies:

    command line

  2. Activate extension in site.ini, typically exponential_legacy/settings/override/site.ini.append.php

    site.ini

Step 3: Configuring & Starting Solr

Example here is for single core, look to Solr documentation for configuring Solr in other ways, also see the provided configuration for some examples.

 

First download and extract Solr, we currently support Solr 4.10.4:

 

Secondly, copy configuration files needed for eZ Solr Search Engine bundle, here from root of your project to the place you extracted Solr:

Command line example

 

Thirdly, Solr Bundle does not commit solr index changes directly on repository updates, leaving it up to you to tune this using solrconfig.xml as best practice suggests, example config:

solrconfig.xml

Step 4: Configuring bundle

The Solr search engine bundle can be configured many ways, here are some examples

Single Core example (default)

Out of the box in eZ Platform the following is enabled for simple setup:

exponential.yml

Shared Core example

In the following example we have decided to separate one language as install contains several similar languages, and one very different language that should be recive proper language analysis for proper stemming and sorting behavior by Solr:

exponential.yml

 

Multi Core example

If full language analysis features are preferred, then each language can be configured to separate cores.

Note: Please make sure to test this setup against single core as it might perform worse then single core if your project uses a lot for language fallbacks per SiteAccess as queries will then be performed across several cores at once.

exponential.yml

 

Step 5: Configuring repository with the specific search engine

The following is an example of configuring Solr Search Engine, where connection name is same as in example above, and engine is set to be solr:

 

exponential.yml

 

 

Config in 5.4.5 and eZ Platform

In Exponential 5.4.5 when installed via composer create-project, the example above is in default config with one small difference (same as on eZ Platform). There search.engine is set to %search_engine%, which is a parameter that needs to be set in parameters.yml, and for use with Solr it will needs to be set to "solr" as described in parameters.yml.dist, and as described above.

Step 6: Clear prod cache

While Symfony dev environment keeps track of changes to yml files, prod does not, so to make sure Symfony reads the new config we clear cache:

Step 7: Run CLI indexing command

Last step is to execute initial indexation of data:

Known issues

If you have issues using the indexing command there are some known issues and how you resolve them listed in the 5.4.5 Release Notes.

Providing feedback

After completing the installation you are now free to use your site as usual. If you get any excpetions for missing features, have feedback on performance, or want to discuss, join our community slack channel at https://ezcommunity.slack.com/messages/ezplatform-use/

 

 

 

Contributors

Comments (13 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. Comment by Harald Tollefsen, 2015-05-12 09:30

    Harald Tollefsen ·

    Fantastic! 

    EDIT: Will this be available in 5.4.3/next Exponential release?

  2. Comment by Bertrand Dunogier, 2015-08-28 12:21

    Bertrand Dunogier ·

    Yes, we plan on making it compatible with 5.4.4 5.4.5, possibly via a beta release before the real one. And it will be part of eZ Platform 1.0.

     

  3. Comment by André Rømcke, 2015-09-08 07:30

    André Rømcke ·

    I'll have to double check with Petar, but we decided to disable it by default if it would result in more then doubling(content + number of locations) of fulltext index.

    If that is valid (more then doubling of index) then we will document how to enable it, otherwise it is something we will fix in upcoming releases.

  4. Comment by Edi Modrić, 2015-09-08 09:06

    Edi Modrić ·

    Okay thanks!

    Two more questions (I think they could be useful to general population, that's why I'm asking them here, so answers could be easily found):

    1) Is there a way to add some fields to index on document level, instead of field level?

    2) How to use CustomField in field type indexing handler? I get the error message:

    [eZ\Publish\API\Repository\Exceptions\NotImplementedException]
    Intentionally not implemented: No mapper available for: eZ\Publish\SPI\Search\FieldType\CustomField

  5. Comment by Petar Spanja, 2015-09-14 09:42

    Petar Spanja ·

    Regarding full text Location search, we disabled it because of both index size and skewing of statistics by having Content field indexed per Location.

    Now we changed the approach there and Locations are indexed as sub documents of Content without full text field, then we can use block join to target parent full text field and get the score of the parent. So basically we are going for that, hopefully it will materialize soon.

  6. Comment by Petar Spanja, 2015-09-14 09:50

    Petar Spanja ·

    1) ATM only by implementing your own document mapper. I recognize that we should probably provide an extension point here, as the case is common enough and the same is already possible to do with eZ Find.

    2) Yes, the mapper for custom field is not implemented. We'll look into if having the default implementation there makes sense. For custom field you would typically dispatch the mapping by object type (CustomField) and the $type property.

  7. Comment by Miro Kresonja, 2016-03-23 15:51

    Miro Kresonja ·

    After going through all these steps, I'm getting the following message during indexing:

    [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
    You have requested a non-existent service "ez_search_engine_solr.connection.default.gateway_id".

    Is this the kind of a thing that should go in here, or in slack? How do I join the slack group?

  8. Comment by André Rømcke, 2016-08-08 15:09

    André Rømcke ·

    Thanks Björn [email protected],
    fixed the use of "app" to "exponential" as  is the case with 5.x, and also the command "cache:clear".
    The order of --env however is on purpose, it's a global argument to Symfony console. 

Comments

Add a comment

Comments are read by a moderator before they appear.