From 15e2685562082c34cec792857004c2306ea9d486 Mon Sep 17 00:00:00 2001 From: Martin Kriegeskorte Date: Wed, 8 Feb 2023 17:02:19 +0100 Subject: [PATCH] integrate typesense --- .github/workflows/docsearch.yml | 25 +++++++++++++++++++++ docsearch.config.json | 40 +++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 .github/workflows/docsearch.yml create mode 100644 docsearch.config.json diff --git a/.github/workflows/docsearch.yml b/.github/workflows/docsearch.yml new file mode 100644 index 0000000000..4c3b8351d4 --- /dev/null +++ b/.github/workflows/docsearch.yml @@ -0,0 +1,25 @@ +# Automate, customize, and execute your software development workflows right in your repository with GitHub Actions. +# Documentation: https://docs.github.com/en/actions + +name: docsearch + +on: + workflow_dispatch: + repository_dispatch: + types: + - docsearch + +jobs: + + docsearch: + steps: + - name: Run DocSearch Scraper + shell: bash + run: | + docker run \ + -e TYPESENSE_API_KEY=${{ secrets.TYPESENSE_API_KEY }} \ + -e TYPESENSE_HOST="${{ secrets.TYPESENSE_HOST }}" \ + -e TYPESENSE_PORT="${{ secrets.TYPESENSE_PORT }}" \ + -e TYPESENSE_PROTOCOL="${{ secrets.TYPESENSE_PROTOCOL }}" \ + -e CONFIG="$(cat docsearch.config.json | jq -r tostring)" \ + typesense/docsearch-scraper diff --git a/docsearch.config.json b/docsearch.config.json new file mode 100644 index 0000000000..ab355697ec --- /dev/null +++ b/docsearch.config.json @@ -0,0 +1,40 @@ +{ + "index_name": "tiptap", + "start_urls": [ + "https://tiptap.dev" + ], + "sitemap_alternate_links": true, + "stop_urls": [ + "https://tiptap.dev/hocuspocus" + ], + "selectors": { + "default": { + "lvl0": { + "selector": "", + "global": true, + "default_value": "Documentation" + }, + "lvl1": "main h1", + "lvl2": "main h2", + "lvl3": "main h3", + "lvl4": "main h4", + "lvl5": "main h5", + "lvl6": "main h6", + "text": "main p, main li, main pre, main td" + } + }, + "strip_chars": " .,;:#", + "custom_settings": { + "separatorsToIndex": "_", + "attributesForFaceting": [ + "type", + "lang" + ], + "attributesToRetrieve": [ + "hierarchy", + "text", + "anchor", + "url" + ] + } +}