Solr search

Requirements

You must satisfy the following requirements to successfully connect to the Silverstripe Cloud in-nation shared Solr service

  • If you are starting a new project, best compatibility is achieved by using the recipe: silverstripe/recipe-ccl 
  • Although we don't recommend it, with extra work you can get it working by only including the cwp/cwp-core module.

Solr Version Support

Your project will be configured automatically by the silverstripe/recipe-solr-search module to resemble production infrastructure as much as possible. Currently, the platform only supports Solr version 4.

Limitations and Acceptable Use Policy

Solr on the platform is a shared service, and it comes with some limitations:

  • This Solr server enforces solrconfig.xml - customisations are not permitted, and will automatically be removed by the Solr server.
  • This Solr server ignores all search index commit requests, and instead relies on auto-commits to update indexes. This preserves stability for all users of the shared service. This will manifest as index updates taking a minute or two to appear in the search results, while on local development environment they are immediate.
  • To ensure adequate sharing of resources on Solr the maximum size of each indexed item is limited to 100kb of data.
  • If you are indexing file content, files with text content exceeding this limit will not be fully indexed. Content within this range will still be searchable.

Source Code

The base silverstripe/fulltextsearch module source code is available at https://github.com/silverstripe/silverstripe-fulltextsearch

Integration

The base silverstripe/fulltextsearch module is tightly integrated through the silverstripe/recipe-solr-search module. You usually don't have to install anything extra.

This module sets up:

  • The default Solr search index
  • The Solr environment configuration (host, port, path, version, indexstore etc.)
  • Uploads your application configuration to Solr running on the platform (apart from the solrconfig.xml file)
  • An extension to File class if document search has been enabled
  • A search form and results page inherited by all other page types
  • Spelling and Synonyms (including setting synonym groups in SiteConfig)
  • Boosting keywords extension to pages
  • Custom routing to the search controller (see _config/routes.yml)

If you choose to customise the module's out-of-the-box behaviour with your own custom integration, ensure that your code gracefully handles Solr connectivity or configuration issues, such as server outages or invalid search index definitions.

Running Solr Search Locally

One way to develop with Solr locally is to require silverstripe/fulltextsearch-localsolr package as your dev dependency in your top-level composer.json file.

When selecting versions, make sure you use the version supported by Silverstripe Cloud Public Sector: 4.*@dev.

Older versions of silverstripe-fulltextsearch module used to bundle the Solr binary. You should check the version of this module before proceeding with this guide.

Alternatively you can use the quickstart installer that ships with the latest version of the fulltextsearch module. The quickstart script will install a Solr service on your local machine and set up your _config.php to allow you to get started with minimal intervention.

You can execute the quick start script by running vendor/bin/fulltextsearch_quickstart in your project root.

Differences on the platform

Please read through the Limitations and Acceptable Use Policy of running Solr in the platform infrastructure (located in the above section).

Most importantly, this infrastructure does not permit customisations to solrconfig.xml, this is to ensure stability of the shared service. While you can customise this file on your local development environment, these customisations will be ignored by this Solr server, and the file restored to a version very similar to the default supplied by fulltextsearch module.

Was this answer helpful? Yes No

Sorry we couldn't be helpful. Help us improve this article with your feedback.