Use Pagefind search on local builds without Elastic config

What does this MR do and why?

WHAT

  • This MR adds a fallback to Pagefind for make view command IF any Elasticsearch related variables are not set (ELASTIC_CLOUD_ID, ELASTIC_KEY, and ELASTIC_INDEX).
  • Updates search.md documentation to mention this new behavior.

WHY

  • When technical writers try to run documentation site locally, they will most likely not have the required configuration already set up.
  • It's important to have the fallback search set to "Pagefind" as it requires no set up configs.

Screenshots, screen recordings, or links to review app

Elasticsearch configs are set No Elasticsearch configs are set
es-config-found es-config-missing

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.
  2. Check out this branch.
  3. Test the following,
SCENARIO HOW TO TEST
No elastic configs set in local Run unset ELASTIC_INDEX, run make view in the same terminal. Result: Build logs warn about missing logs and lets user know it's falling back to Pagefind search
Elastic configs are set in local (works like before) In new terminal run make view. Result: Build logs should let you know configs are set and will be running using Elasticsearch
Running archive site (works like before) In new terminal run make view-archive. Result: Should properly build on last minor version and use Pagefind search (this tests that the pagefind_service.js logic change didn't mess up normal archive builds)

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.

Closes #388 (closed)

Edited by Hiru Fernando

Merge request reports

Loading