From d0b54544e9e43a5330c0485d41551128224fe4d3 Mon Sep 17 00:00:00 2001 From: Mohammed Gomaa Date: Fri, 28 Nov 2025 16:03:18 +0200 Subject: [PATCH] fix: typesense doc sync (#11807) Co-authored-by: Giorgio Boa <35845425+gioboa@users.noreply.github.com> --- .github/workflows/docsearch.yml | 28 ++++++++++++++++++++++++++++ docs/docsearch-scraper-config.json | 9 ++------- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docsearch.yml b/.github/workflows/docsearch.yml index e2c78c532..6595feee2 100644 --- a/.github/workflows/docsearch.yml +++ b/.github/workflows/docsearch.yml @@ -12,7 +12,35 @@ jobs: steps: - uses: actions/checkout@v5 + - name: Delete unaliased collections + env: + TYPESENSE_API_KEY: ${{ secrets.TYPESENSE_API_KEY }} + TYPESENSE_HOST: ${{ secrets.TYPESENSE_HOST }} + TYPESENSE_PROTOCOL: https + TYPESENSE_PORT: 443 + run: | + ALIAS_COLLECTION=$(curl -s -H "X-TYPESENSE-API-KEY: $TYPESENSE_API_KEY" \ + "$TYPESENSE_PROTOCOL://$TYPESENSE_HOST:$TYPESENSE_PORT/aliases/typeorm-docs" \ + | jq -r '.collection_name') + if [ "$ALIAS_COLLECTION" = "null" ] || [ -z "$ALIAS_COLLECTION" ]; then + echo "Alias does not exist; skipping collection cleanup." + exit 0 + fi + + echo "Alias currently points to: $ALIAS_COLLECTION" + + COLLECTIONS=$(curl -s -H "X-TYPESENSE-API-KEY: $TYPESENSE_API_KEY" \ + "$TYPESENSE_PROTOCOL://$TYPESENSE_HOST:$TYPESENSE_PORT/collections" \ + | jq -r '.[].name') + + for col in $COLLECTIONS; do + if [ "$col" != "$ALIAS_COLLECTION" ]; then + echo "Deleting unaliased collection: $col" + curl -s -X DELETE -H "X-TYPESENSE-API-KEY: $TYPESENSE_API_KEY" \ + "$TYPESENSE_PROTOCOL://$TYPESENSE_HOST:$TYPESENSE_PORT/collections/$col" + fi + done - run: | docker run \ -e TYPESENSE_API_KEY=${{ secrets.TYPESENSE_API_KEY }} \ diff --git a/docs/docsearch-scraper-config.json b/docs/docsearch-scraper-config.json index 8c0ff6791..67fe8ca7c 100644 --- a/docs/docsearch-scraper-config.json +++ b/docs/docsearch-scraper-config.json @@ -27,12 +27,7 @@ "strip_chars": " .,;:#", "custom_settings": { "separatorsToIndex": "_", - "attributesForFaceting": [ - "language", - "version", - "type", - "docusaurus_tag" - ], + "attributesForFaceting": [], "attributesToRetrieve": [ "hierarchy", "content", @@ -46,4 +41,4 @@ "833762294" ], "nb_hits": 0 -} \ No newline at end of file +}