You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by bl...@apache.org on 2022/08/23 17:00:27 UTC

[iceberg-docs] branch main updated: Add workflow for merging search indexes (#144)

This is an automated email from the ASF dual-hosted git repository.

blue pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-docs.git


The following commit(s) were added to refs/heads/main by this push:
     new 70a43e2e Add workflow for merging search indexes (#144)
70a43e2e is described below

commit 70a43e2e42a94cd2dec22a87b2e5fff5f4c7717f
Author: Samuel Redai <43...@users.noreply.github.com>
AuthorDate: Tue Aug 23 10:00:22 2022 -0700

    Add workflow for merging search indexes (#144)
---
 .github/workflows/merge-search-indexes.yml | 29 +++++++++++++++++++++++++++++
 docs/config.toml                           |  2 +-
 docs/layouts/index.searchindex.json        | 16 ++++++++++++++++
 landing-page/config.toml                   |  2 +-
 4 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/merge-search-indexes.yml b/.github/workflows/merge-search-indexes.yml
new file mode 100644
index 00000000..814e9d72
--- /dev/null
+++ b/.github/workflows/merge-search-indexes.yml
@@ -0,0 +1,29 @@
+name: Merge Landing-Page and Latest Docs Site Search Indexes
+
+on: workflow_dispatch
+
+jobs:
+  merge-search-indexes:
+    runs-on: ubuntu-20.04
+    steps:
+      - name: Clone the asf-site branch
+        uses: actions/checkout@v3
+        with:
+          ref: asf-site
+
+      - name: Setup Python 3.10
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.10'
+
+      - name: Merge landing-page and docs site search indexes
+        run: python -c "import os; import json; combined = json.load(open('landingpagesearch.json')) + json.load(open('docs/latest/docssearch.json')); os.mkdir('out'); json.dump(combined, open('out/search.json', 'w'));"
+
+      - name: Deploy combined search index to asf-site branch
+        uses: peaceiris/actions-gh-pages@v3
+        with:
+          github_token: ${{ secrets.GITHUB_TOKEN }}
+          publish_dir: ./out
+          publish_branch: asf-site
+          destination_dir: ./
+          keep_files: true
\ No newline at end of file
diff --git a/docs/config.toml b/docs/config.toml
index db267080..0767ce7f 100644
--- a/docs/config.toml
+++ b/docs/config.toml
@@ -15,7 +15,7 @@ theme= "iceberg-theme"
   disableHome=true
 
 [outputFormats.SearchIndex]
-baseName = "search"
+baseName = "docssearch"
 mediaType = "application/json"
 
 [outputs]
diff --git a/docs/layouts/index.searchindex.json b/docs/layouts/index.searchindex.json
new file mode 100644
index 00000000..8a2f67c2
--- /dev/null
+++ b/docs/layouts/index.searchindex.json
@@ -0,0 +1,16 @@
+[
+    {{- $pages := where .Site.RegularPages "Params.excludeFromSearch" "!=" true -}}
+    {{- $pages := where $pages "Content" "not in" (slice nil "") -}}
+    {{- range $index, $page := $pages -}}
+        {{- if eq $page.Params.excludeFromSearch true -}}
+        {{ else }}
+          {{- if gt $index 0 -}} , {{- end -}}
+          {{- $uri := print "/docs/latest" $page.RelPermalink -}}
+          {{- $entry := dict "uri" $uri "title" $page.Title -}}
+          {{- $entry = merge $entry (dict "content" ($page.Plain | htmlUnescape)) -}}
+          {{- $entry = merge $entry (dict "description" $page.Description) -}}
+          {{- $entry = merge $entry (dict "categories" $page.Params.categories) -}}
+          {{- $entry | jsonify -}}
+        {{- end -}}
+    {{- end -}}
+  ]
\ No newline at end of file
diff --git a/landing-page/config.toml b/landing-page/config.toml
index 436e774e..457c32c0 100644
--- a/landing-page/config.toml
+++ b/landing-page/config.toml
@@ -25,7 +25,7 @@ sectionPagesMenu = "main"
   url = "https://join.slack.com/t/apache-iceberg/shared_invite/zt-tlv0zjz6-jGJEkHfb1~heMCJA3Uycrg"  
 
 [outputFormats.SearchIndex]
-baseName = "search"
+baseName = "landingpagesearch"
 mediaType = "application/json"
 
 [outputs]