Ruby JavaScript HTML CSS Gherkin Shell
Switch branches/tags
Clone or download
thomasleese Merge pull request #543 from alphagov/dependabot/bundler/govuk_fronte…
…nd_toolkit-7.6.0

Bump govuk_frontend_toolkit from 7.5.0 to 7.6.0
Latest commit 8741b21 Jul 19, 2018
Permalink
Failed to load latest commit information.
app Reject malformed results from the finder facet Jul 2, 2018
bin Fix Rubocop on CI Mar 8, 2017
config Remove raise_on_unfiltered_parameters Apr 27, 2018
db Rails, rspec, cucumber Jan 23, 2014
docs Add some documentation about advanced search finder Mar 29, 2018
features Reject malformed results from the finder facet Jul 2, 2018
lib Capitalise email subscription list titles correctly Mar 28, 2018
log Rails, rspec, cucumber Jan 23, 2014
public Remove unused files Mar 31, 2014
script Rails, rspec, cucumber Jan 23, 2014
spec Resolve deprecation warning Jun 28, 2018
vendor/assets Rails, rspec, cucumber Jan 23, 2014
.dockerignore Add dockerignore Jan 16, 2018
.gitignore Simplecov for test coverage Sep 8, 2014
.rspec Rails, rspec, cucumber Jan 23, 2014
.rubocop.yml Fix Rubocop on CI Mar 8, 2017
.ruby-version Bump to ruby-2.5.1 May 29, 2018
Dockerfile Bump to ruby-2.5.1 May 29, 2018
Gemfile Bump govuk_frontend_toolkit from 7.5.0 to 7.6.0 Jul 18, 2018
Gemfile.lock Bump govuk_frontend_toolkit from 7.5.0 to 7.6.0 Jul 18, 2018
Jenkinsfile Update Jenkinsfile to use external library Mar 2, 2018
LICENCE.txt Correct copyright notice Feb 16, 2015
Procfile Configure procfile to run independent of Heroku Feb 16, 2018
README.md Link README to advanced search finder docs Mar 29, 2018
Rakefile Remove redundant tests runners Mar 6, 2017
app.json Configure heroku example finder Mar 19, 2018
config.ru Fix Rubocop on CI Mar 8, 2017
startup.sh Add live flag consistent with government-frontend to startup.sh May 31, 2017

README.md

Finder Frontend

Finder frontend renders search on GOV.UK.

Live examples

Site search

Site search is available from the header of every page.

Site search screenshot

Finder pages

Finder pages provide facetted searching over a collection of documents.

The advanced search finder provides facetted searching of GOV.UK taxonomy and content types:

Read more about the advanced search finder

Finder frontend screenshot

Nomenclature

  • Finder: Page containing a list of filterable documents and filters.
  • Facets: Metadata associated with documents.
  • Filters: Searchable/filterable metadata for example case_state={open|closed} for a CMA case.

Dependencies

  • alphagov/static: provides static assets (JS/CSS) and provides the GOV.UK templates.
  • alphagov/content-store: provides the content items for the finder itself -- containing the finder title, tagged organisations and related links
  • alphagov/rummager: provides search results

Running the application

$ ./startup.sh

If you are using the GDS development virtual machine then the application will be available on the host at http://finder-frontend.dev.gov.uk/

Running the test suite

Before you can run the test suite you'll need the govuk-content-schemas repository locally. See lib/govuk_content_schema_examples.rb for more details.

The default rake task runs all the tests:

$ bundle exec rake

The application has jasmine tests, which can be accessed at /specs when the application is running in development mode. These are also run when rake, above, is run.

Making a new finder

  1. If required, add a schema to alphagov/rummager describing your document type -- example
  2. Publish a Finder Content Item to the content store. See the doc for Finder Content Item for more info.
  3. Ensure your documents are indexed in alphagov/rummager correctly.

Developing a finder locally

You can run this application with a local file so you can develop a finder without having to publish the content item to the publishing-api.

For example:

DEVELOPMENT_FINDER_JSON=features/fixtures/aaib_reports_example.json ./startup.sh --live

How to add a fixed filter?

You can use gov.uk/api/search.json?filter_link= with the path of the page you looking for to migrate.

For example, you want to filter by the field link on /government/world/organisations You can access the following: https://www.gov.uk/api/search.json?filter_link=/government/world/organisations/british-antarctic-territory You will be able to see inside results the field format

You can double check the filter by performing the following search using rummager:

http://rummager.dev.gov.uk/search.json?filter_NAME=VALUE

For more information please refer to the search api documentation.

Application structure

  • No data store -- all data comes via the APIs mentioned above.
  • app/models contains two kinds of object.
    1. Value objects used to wrap up responses from API calls.
    2. Facet objects which wrap up the behaviour of different types of facet -- eg radios, selects, etc.
  • app/presenters contains objects which serialise the value objects to hashes for display via mustache.
  • app/parsers contains objects which transform API responses into models.