From bd2222149612b325729f301740f3fba7975280bf Mon Sep 17 00:00:00 2001 From: Gerhard Lazu Date: Wed, 23 Mar 2022 14:02:37 +0000 Subject: [PATCH] Rebuild Algolia search index for docs Only include the Europa docs cd website ./rebuild_algolia_docs_search_index.sh jq is /Users/gerhard/.nix-profile/bin/jq docker is /Users/gerhard/.nix-profile/bin/docker > DocSearch: https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1202/plan/ 16 records) > DocSearch: https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1214/migrate-from-dagger-0.1/ 5 records) > DocSearch: https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/index.html 40 records) > DocSearch: https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1213/api/ 47 records) > DocSearch: https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1201/ci-environment/ 15 records) > DocSearch: https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1203/client/ 21 records) > DocSearch: https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1211/go-docker-swarm/ 15 records) > DocSearch: https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1204/secrets/ 12 records) > DocSearch: https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1205/container-images/ 9 records) Nb hits: 180 Fixes #1832 Signed-off-by: Gerhard Lazu --- website/docsearch.config.json | 16 +++++++++++----- website/env.example | 7 +++++++ website/rebuild_algolia_docs_search_index.sh | 11 +++++++++++ 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 website/env.example create mode 100755 website/rebuild_algolia_docs_search_index.sh diff --git a/website/docsearch.config.json b/website/docsearch.config.json index 82eb41f5..e6935533 100644 --- a/website/docsearch.config.json +++ b/website/docsearch.config.json @@ -1,16 +1,22 @@ { "index_name": "Dagger_docs", "start_urls": [ - "https://deploy-preview-929--devel-docs-dagger-io.netlify.app/" - ], - "sitemap_urls": [ - "https://deploy-preview-929--devel-docs-dagger-io.netlify.app/sitemap.xml" + "https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/index.html", + "https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1201/ci-environment/", + "https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1202/plan/", + "https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1203/client/", + "https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1204/secrets/", + "https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1205/container-images/", + "https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1211/go-docker-swarm/", + "https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1213/api/", + "https://deploy-preview-1833--devel-docs-dagger-io.netlify.app/1214/migrate-from-dagger-0.1/" ], + "sitemap_urls": [], "sitemap_alternate_links": true, "stop_urls": [], "selectors": { "lvl0": { - "selector": "(//ul[contains(@class,'menu__list')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text() | //nav[contains(@class, 'navbar')]//a[contains(@class, 'navbar__link--active')]/text())[last()]", + "selector": "(//nav[contains(@class,'menu')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text())[last()]", "type": "xpath", "global": true, "default_value": "Documentation" diff --git a/website/env.example b/website/env.example new file mode 100644 index 00000000..77ab624c --- /dev/null +++ b/website/env.example @@ -0,0 +1,7 @@ +# https://www.algolia.com/apps/XSSC1LRN4S/explorer/browse/Dagger_docs +APPLICATION_ID=XSSC1LRN4S +# Copy your "Write API KEY" from https://www.algolia.com/account/api-keys/all?applicationId=XSSC1LRN4S +API_KEY= +# This will not work on an ARM Mac, the algolia/docsearch-scraper image was only built for linux 64bit +# I am using a Docker Engine on Linux here: +DOCKER_HOST=ssh://192.168.1.22 diff --git a/website/rebuild_algolia_docs_search_index.sh b/website/rebuild_algolia_docs_search_index.sh new file mode 100755 index 00000000..8712e001 --- /dev/null +++ b/website/rebuild_algolia_docs_search_index.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -eo pipefail + +type jq +type docker + +docker run -it \ + -e API_KEY="${API_KEY:?must be set}" \ + -e APPLICATION_ID="${APPLICATION_ID:?must be set}" \ + -e "CONFIG=$(jq -r tostring < docsearch.config.json)" \ + algolia/docsearch-scraper