You are viewing an old version of this page. View the current version.
Version 1.0.x of Solr Bundle primarily aims to be used as replacement for Legacy (SQL-based) search engine for better scalability and performance (especially with field criteria and sort clauses). And while it also provides better full text search thanks to Solr, more advance search features like Faceting will come in later releases.
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 existing Search queries using SearchService, will be powered by Solr automatically. This allows you to scale up your eZ Platform installation and be able to continue development locally against SQL engine, and have a test infrastructure, Staging and Prod powered by Solr, thus removing considerable load from your database so it can focus on more important things, like publishing .
See Architecture page for further information on the architecture of eZ Platform.
How to set up Solr Search engine
Step 1: Enabling the Bundle
Not needed with eZ Platform
This step is not needed for eZ Platform as of 15.09, however it is kept here for reference in case you have previously disabled the bundle.
Add/Update composer dependencies:
- Activate EzPublishSolrSearchEngineBundle by adding the following lines to your
Step 2: Configuring & Starting Solr
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 the root of your project to the place you extracted Solr:
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:
Step 3: Configuring bundle
The Solr search engine bundle can be configured many ways, in the config further below it assumes you have parameters setup for solr dsn and search engine (however both are optional), example:
On to configuring the bundle.
Single Core example (default)
Out of the box in eZ Platform the following is enabled for simple setup:
Shared Core example
In the following example we have decided to separate one language as the installation contains several similar languages, and one very different language that should receive proper language analysis for proper stemming and sorting behavior by Solr:
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 setup, as it might perform worse than single core if your project uses a lot of language fallbacks per siteaccess, as queries will then be performed across several cores at once.
Step 4: 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
%search_engine% is a parameter that is configured in
app/config/parameters.yml, and should be changed from its default value "
legacy" to "
solr" to activate Solr as the Search engine.
Step 5: 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 6: Run CLI indexing command
Make sure to configure your setup for indexing
Some exceptions might happen on indexing if you have not configured your setup correctly, here are the most common issues you may encounter:
- Exception if Binary files in database have an invalid path prefix
- Make sure
var_diris configured properly.
- If your database is inconsistent in regards to file paths, try to update entries to be correct (but make sure to make a backup first).
- Make sure
- Exception on unsupported Field Types
- Content not immediately available
- Solr Bundle is on purpose not committing changes directly on Repository updates (on indexing), but letting you control this using Solr configuration. Adjust Solr autoSoftCommit visibility of change to search index) and/or autoCommit (hard commit, for durability and replication) to balance performance and load on your Solr instance against needs you have for "NRT".
- Running out of memory during indexing
- In general make sure to run indexing using prod environment to avoid debuggers and loggers from filing up memory.
- Flysystem: An open issue exists where you can find further info https://jira.ez.no/browse/EZP-25325
Last step is to execute initial indexation of data:
After completing the installation you are now free to use your site as usual. If you get any exceptions for missing features, have feedback on performance, or want to discuss, join our community slack channel at https://ezcommunity.slack.com/messages/ezplatform-use/