diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 53a60a2b..2420ff44 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -59,3 +59,23 @@ jobs: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 + + # A new docs version starts with zero records in Algolia, and contextual + # search filters on it, so the search box returns nothing until a recrawl. + reindex: + needs: deploy + if: github.event_name == 'push' + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Reindex Algolia when a docs version is released + run: | + git diff --name-only ${{ github.event.before }} ${{ github.sha }} \ + | grep -qxF versions.json || exit 0 + curl -sS -f -X POST \ + -u "${{ secrets.ALGOLIA_CRAWLER_USER_ID }}:${{ secrets.ALGOLIA_CRAWLER_API_KEY }}" \ + "https://crawler.algolia.com/api/1/crawlers/9bc2ab68-0ce9-4f44-9824-3a48219680b2/reindex" diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 45a5e05e..cf709720 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -310,6 +310,11 @@ const config: Config = { indexName: "Fishjam", contextualSearch: true, searchPagePath: "search", + searchParameters: { + // Without this, generated API headings that are exactly the query + // outrank guides before weight.pageRank is ever consulted. + exactOnSingleWordQuery: "word", + }, insights: false, askAi: { assistantId: "49fdf088-e614-4b89-86c2-da8c4b566260",