specialist-publisher: Creating or editing specialist document types
Creating a specialist document type
1. Add a schema to govuk-content-schemas
See example PR for adding
Note: this is a link to a PR in the now-archived content schemas repo. Content schemas have now been moved to publishing api.
Please update this document when an example for publishing api is available.
- Add the format to this list and to this list
- Add any new field definitions to this file
- Add examples as instructed. You can copy and paste from another specialist document format, only changing what is necessary (you can leave the body and headers unchanged).
You'll need to generate your own UUIDs for the
$ irb irb(main):001:0> require "securerandom" => true irb(main):002:0> SecureRandom.uuid => "5087e8b6-ee54-40f9-b592-8c2813c7037d"
bundle exec rake build_schemasto regenerate schemas.
When the PR is reviewed and its tests passing, it can be merged and deployed at this point.
2. Create a new specialist document format in Specialist Publisher
Create the schema
See CMA cases.
New formats are often requested to be deployed in "pre-production mode", which is configured in this step (example).
pre-production documents are only publishable on development and integration.
Create the model
See CMA cases
Create the view template
3. Configure Search API
Search API needs copies of the schema very similar to the one in Specialist Publisher. See:
You'll also need to add your document format to:
Finally, you'll need to add your custom fields to:
4. Configure the email sign up page
The email sign up page is rendered by Finder Frontend using the configuration in the new schema added to specialist publisher.
5. Deploy and publish
- Deploy Specialist Publisher and Search API (and govuk-content-schemas if you haven't already).
- Reindex the govuk Elasticsearch index.
- This takes around 30-45 minutes on Production, or 3-4 hours on Integration.
- NB: reindexing shouldn't really be necessary; Elasticsearch will dynamically create the field mappings the first time a new document of this type is published. In other words, if you publish a new document type, the finder will work and it will return the relevant documents even without a reindex. However, the filters on the finder would not work, as this reindexing job also builds the filters for the finder, so we have to run the job.
- Use the "Run rake task" Jenkins job to run
publishing_api:publish_finder[your_format_name_based_on_the_schema_file]against the specialist publisher app on a backend machine.
Specialist Publisher grants access to the publishing interface for your new document type to the following Signon users:
- Users that belong to the owner organisation AND have
- Users that have the permission
You'll need to create the new permission manually.
Editing a specialist document type
We often receive requests to add new fields to a specialist document. Or to add new values to existing fields.
Adding a new field to an existing specialist document
In search-api, add the new field in the following places (see this commit for an example):
- the relevant schema in the elasticsearch_types directory.
- the elasticsearch_presenter.
- the specialist_presenter.
- the field_definitions file.
- Follow steps in the Deploy and publish section above, to re-publish the finder and reindex the GOVUK search index.
Adding or amending values for existing fields on a specialist document
- In govuk-content-schemas, find the field you are amending in the specialist_document schema, and add the new values. See this commit for an example.
NOTE: You will need to run
bundle exec rake build_schemas to regenerate schemas after adding the new value(s) - as is done in this commit.
Once approved, this change can be merged and deployed.
Republish the finder, see step 3 in the Deploy and publish section above. You do not need to reindex search :sweat_smile: