Creating and Adding Custom Solr Files to Code Repository

You can customize Solr by creating Solr configuration files and the relevant schema.

Prerequisites

Context

During the build process, your custom Solr files replace the ones that are provided by SAP Commerce Cloud. To learn more about Solr configuration files, see Configuration FilesInformation published on non-SAP site.

Solr configuration files can have the following extensions:

  • .cfg
  • .html
  • .jar
  • .json
  • .png
  • .properties
  • .txt
  • .vm
  • .xml
  • .xsl

When extending your Solr configuration using custom JAR files, use the same version of Java to compile your files as in the corresponding SAP Commerce Cloud version. For more information on Java versions in SAP Commerce Cloud, see Third-Party Compatibility.

Procedure

  1. In your code repository, navigate to the directory with your core customization files. Make sure that your manifest.json file is also there as the location of files specified in it is always relative to the directory with the manifest. For more information, see Project Customizations.
  2. Create the following files:
    <solr custom folder>/server/solr/configsets/default/conf
    Replace <solr custom folder> with a name of your customization folder.
  3. Navigate to <solr custom folder>/server/solr and add your solr.xml file.
  4. Navigate to <solr custom folder>/server/solr/configsets/default/conf and add the schema.xml and solrconfig.xml files.
  5. In the SAP Commerce Cloud manifest, add the solr component to the useConfig section and point to your Solr customization file:
    "useConfig": {
        "solr": {
            "location": "<solr custom folder>"}}
  6. Commit and push your changes.
  7. In the Cloud Portal, create a build and deploy it to an environment.

Results

Your Solr customization is included in your environment.