This is an automated email from the ASF dual-hosted git repository.
blue pushed a commit to branch latest
in repository https://gitbox.apache.org/repos/asf/iceberg-docs.git
The following commit(s) were added to refs/heads/latest by this push:
new d568e70e Add workflow for merging search indexes (#143)
d568e70e is described below
commit d568e70eb36faa89d7b65f71cbb4858b67048935
Author: Samuel Redai <[email protected]>
AuthorDate: Tue Aug 23 10:07:13 2022 -0700
Add workflow for merging search indexes (#143)
---
.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 0ca3c85b..739bc138 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..980a9252
--- /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]