Skip to content

Compress Lunr index files

Sarah German requested to merge compress-lunr-indexes into main

What does this MR do and why?

Creates gzip versions of the Lunr search index JSON files.

This will improve frontend performance on pages that include these files.

Closes #1671 (closed)

Screenshots, screen recordings, or links to review app

Before After
image image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md.
  2. Compile the site (make compile), then build the Lunr index: make build-lunr-index
  3. Verify that public/assets/javascripts contains these compressed files: lunr-index.json.gz and lunr-map.json.gz, in addition to the non-compressed versions (same names, minus the .gz)

Your local web server (make view) won't serve the compressed file, but you can see it on the review app: https://compress-lunr-indexes.docs.gitlab-review.app/search/?q=testing (use browser dev tools as shown in the screenshots, or you can test with cURL, like this: curl -IH 'Accept-encoding: gzip' https://compress-lunr-indexes.docs.gitlab-review.app/assets/javascripts/lunr-index.json)

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sarah German

Merge request reports

Loading