Commit 74471ac3 authored by Damian Mooyman's avatar Damian Mooyman

Merge branch 'docs-solr-4' into 'master'

Update docs on how to configure and develop on solr for CWP.



See merge request !156
parents 16bfd6d1 0cbf7ea8
title: Solr Configuration on CWP
summary: How Solr is pre-configured for CWP and what you can alter.
# Solr Configuration on CWP
# Solr Configuration for CWP
## Requirements
......@@ -9,7 +9,6 @@ You must satisfy the following requirements to successfully connect to the share
* If you are starting a new project, best compatibility is achieved by using the [cwp-installer](https://gitlab.cwp.govt.nz/cwp/cwp-installer/).
* If it's an existing project, you should include the [cwp-recipe-basic](https://gitlab.cwp.govt.nz/cwp/cwp-recipe-basic) for the ease of integration. Although we don't recommend it, with extra work you can get it working by only including the [cwp-core](https://gitlab.cwp.govt.nz/cwp/cwp-core/) module.
* You must ensure `CwpSolr` is configured to use 'cwp-4' or higher (on CWP).
## Selecting Solr version
......@@ -17,32 +16,16 @@ You must satisfy the following requirements to successfully connect to the share
As of 28/09/2016 'legacy' and 'cwp-3' versions are not supported on CWP anymore.
</div>
If you are setting up your project using [cwp-installer](https://gitlab.cwp.govt.nz/cwp/cwp-installer) (1.0.2 or later) it will [pre-configure](https://gitlab.cwp.govt.nz/cwp/cwp-installer/blob/1.4.1/mysite/_config/config.yml#L19) your project to use Solr 4 when on CWP and local Solr when on your dev machine. You can skip this section altogether.
On CWP Solr is configured through the `CwpSolr` class. It's recommended to use the [Configuration API](https://docs.silverstripe.org/en/3.2/developer_guides/configuration/configuration/) to set the specific options.
To customise the desired version of Solr you can for example modify the
`mysite/_config/solr.yml` file (don't forget to flush the cache):
---
Only:
constantdefined: CWP_ENVIRONMENT
---
CwpSolr:
options:
version: 'cwp-4'
---
Except:
constantdefined: CWP_ENVIRONMENT
---
CwpSolr:
options:
version: 'local-4'
The supported options are:
* 'cwp-4': uses secured 4.x Solr service available on CWP
* 'local-4': used for development using [silverstripe-localsolr](http://addons.silverstripe.org/add-ons/silverstripe/fulltextsearch-localsolr) package, 4.x branch
Your project will be configured automatically by the *cwp-core* module to resemble production infrastructure as much as possible.
Currently CWP supports only Solr version 4.
## Limitations
Solr on CWP is a shared service, and it comes with some limitations:
* Production CWP enforces `solrconfig.xml` - customisations are not permitted, and will automatically be removed by the Solr server. The best way to add features to CWP is through the [Operational Review Board](https://www.cwp.govt.nz/about/frequently-asked-questions/).
* Acceptable use policy applies, as described on the introduction page of this guide.
## Where are the CWP Solr related classes and configuration?
......@@ -53,8 +36,8 @@ The module source code is available at [https://gitlab.cwp.govt.nz/cwp/cwp-core]
This module sets up:
* The default CWP Solr search index
* The Solr environment configuration (host, port, path, version, indexstore etc)
* Uploads your application configuration to Solr running on CWP
* The Solr environment configuration (host, port, path, version, indexstore etc.)
* Uploads your application configuration to Solr running on CWP (apart from the solrconfig.xml file)
* An extension to File class if document search has been enabled
### cwp module
......@@ -63,7 +46,7 @@ The module source code is available at [https://gitlab.cwp.govt.nz/cwp/cwp](http
This module sets up:
* A search form and results page inheristed by all other page types
* 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 CWP search controller (see _config/routes.yml)
......
......@@ -12,11 +12,25 @@ When selecting versions, make sure you use the version supported by CWP: `4.*@de
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.
</div>
### Configuring
## Differences to CWP
### solrconfig.xml
CWP infrastructure enforces `solrconfig.xml` to ensure stability of the shared service.
While you can customise this file on your local development environment, these customisations will automatically be removed by the CWP Solr server, and the file restored to a version very similar to the default supplied by *fulltextsearch* module.
### Auto-commits
CWP Solr server ignores all commit requests originating from the client, 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.
## Configuring
If you have configured your project as described in the Configuration section of this guide, there is no need for any additional setup.
### Running
## Running
To start the local server instance (if you are using the *silverstripe/fulltextsearch-localsolr* package), from your
website root do:
......@@ -36,13 +50,6 @@ And finally, reindex the pages on your website (this could take some time):
You should be able to search your site now.
## Differences to CWP
There are some differences between locally running Solr, and the Solr service running on CWP:
* CWP does not permit customistion of the `solrconfig.xml` file. If you want to use a custom configuration, you'll need to submit it through the Service Desk for vetting.
* CWP Solr is a shared service and comes with certain limitations as described in the Acceptable Use Policy on the introduction page of this guide.
## Debugging locally via the web interface
You can visit `http://localhost:8983/solr`, which will show you a list
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment