Magento 2.0.18 is the final 2.0.x release. After March 2018, Magento 2.0.x will no longer receive security patches, quality fixes, or documentation updates.
To maintain your site's performance, security, and PCI compliance, upgrade to the latest version of Magento.

Set up Solr service

Solr is highly reliable, scalable and fault tolerant, providing distributed indexing, replication and load-balanced querying, automated failover and recovery, centralized configuration, and more.

Limited Support: We only support Solr in Magento Commerce Cloud 2.0.X. You should move to Elasticsearch for Magento Commerce Cloud 2.1 and later, 2.2 and later.

Solr uses the Lucene Java search library for full-text indexing and search. Your applications interact with Solr using:

  • HTTP POST in JSON, XML, CSV, or binary formats to index documents
  • HTTP GET to retrieve search results back as JSON, XML, or a variety of other formats including Python, Ruby, PHP, CSV, binary, and so on

We support Solr version 4.10 for Magento Commerce Cloud.

For more information about Solr, see the following:

Add Solr in services.yaml and .magento.app.yaml

To enable Solr, add the following code with your installed version and allocated disk space in MB to .magento/services.yaml.

mysearch:
    type: solr:4.10
    disk: 1024

If you want to provide your own Solr configuration, you can add a core_config key in your .magento/services.yaml:

mysearch:
    type: solr:4.10
    disk: 1024
    configuration:
        core_config: !archive "<directory>"

The directory parameter points to the Magento vendor/magento/module-solr/conf directory, relative to the .magento directory, in the Git repository. This directory contains the Magento schema.

To configure the relationships for the environment variable, set a relationship in your .magento.app.yaml in the Git branch. For example:

relationships:
    solr: "mysearch:solr"

Merge and deploy the code to set the configurations for Solr. For information on how these changes affect your environments, see services.yaml.

Verify environment-related relationships

We use the Magento Commerce Cloud environment variable $MAGENTO_CLOUD_RELATIONSHIPS, a JSON object, to retrieve environment-related relationships.

To verify this information used for configurations and settings:

  1. SSH into the Integration environment with Solr installed and configured.
  2. Enter the following command to pretty-print connection information for Solr:

     php -r 'print_r(json_decode(base64_decode($_ENV["MAGENTO_CLOUD_RELATIONSHIPS"])));'
    

The response includes all relationships for services and configuration data for that environment. In the response, you will locate data similar to the following for Solr:

{
    "solr": [
        {
            "path": "solr",
            "host": "192.0.2.55",
            "scheme": "solr",
            "port": 8080
        }
    ]
}
Updated