Skip to content

Commit 149b3b7

Browse files
author
AztecBot
committed
Merge branch 'next' into merge-train/fairies
2 parents 23626b1 + a248d30 commit 149b3b7

2 files changed

Lines changed: 109 additions & 3 deletions

File tree

.github/workflows/docs-typesense.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,41 @@ jobs:
3535
# ~12k to 48 records) into a loud CI failure.
3636
MIN_HITS: "5000"
3737
run: |
38-
set -o pipefail
38+
set -euo pipefail
39+
40+
# Derive the version-specific docusaurus_tag values from the docs version
41+
# configs and append them to the api-nr start_url's docusaurus_tag array.
42+
# Each plugin instance produces a tag of the form `docs-${pluginId}-${versionName}`.
43+
# The unversioned tags (participate, root, default) are already in the static
44+
# config; this step adds entries for `developer` and `network` which bump on
45+
# release. Without this, the api-nr records would lose contextual search
46+
# visibility every time mainnet/testnet versions change.
47+
extra_tags=$(jq -nc \
48+
--slurpfile dev docs/developer_version_config.json \
49+
--slurpfile net docs/network_version_config.json \
50+
'[
51+
("docs-developer-" + ($dev[0].mainnet // "")),
52+
("docs-developer-" + ($dev[0].testnet // "")),
53+
("docs-network-" + ($net[0].mainnet // "")),
54+
("docs-network-" + ($net[0].testnet // ""))
55+
] | map(select(. != "docs-developer-" and . != "docs-network-")) | unique')
56+
echo "Derived docusaurus_tag values: $extra_tags"
57+
58+
config_json=$(jq -c --argjson extra "$extra_tags" '
59+
.start_urls |= map(
60+
if .selectors_key == "api-nr"
61+
then .extra_attributes.docusaurus_tag = ((.extra_attributes.docusaurus_tag // []) + $extra | unique)
62+
else .
63+
end
64+
)
65+
' docs/typesense.config.json)
66+
3967
docker run \
4068
-e "TYPESENSE_API_KEY=${{ secrets.TYPESENSE_API_KEY }}" \
4169
-e "TYPESENSE_HOST=${{ secrets.TYPESENSE_HOST }}" \
4270
-e "TYPESENSE_PORT=443" \
4371
-e "TYPESENSE_PROTOCOL=https" \
44-
-e "CONFIG=$(cat docs/typesense.config.json | jq -r tostring)" \
72+
-e "CONFIG=$config_json" \
4573
typesense/docsearch-scraper:0.11.0 2>&1 | tee scraper.log
4674
4775
nb_hits=$(grep -oE 'Nb hits: *[0-9]+' scraper.log | tail -1 | grep -oE '[0-9]+' || true)

docs/typesense.config.json

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
{
55
"url": "https://docs.aztec.network/aztec-nr-api/mainnet/",
66
"selectors_key": "api-nr",
7-
"page_rank": 2
7+
"page_rank": 2,
8+
"extra_attributes": {
9+
"language": "en",
10+
"docusaurus_tag": [
11+
"docs-participate-current",
12+
"docs-root-current",
13+
"default"
14+
]
15+
}
816
},
917
{
1018
"url": "https://docs.aztec.network/",
@@ -55,6 +63,76 @@
5563
"url",
5664
"url_without_anchor",
5765
"type"
66+
],
67+
"field_definitions": [
68+
{ "name": "anchor", "type": "string", "optional": true },
69+
{ "name": "content", "type": "string", "optional": true },
70+
{ "name": "url", "type": "string", "facet": true },
71+
{
72+
"name": "url_without_anchor",
73+
"type": "string",
74+
"facet": true,
75+
"optional": true
76+
},
77+
{
78+
"name": "version",
79+
"type": "string[]",
80+
"facet": true,
81+
"optional": true
82+
},
83+
{
84+
"name": "hierarchy.lvl0",
85+
"type": "string",
86+
"facet": true,
87+
"optional": true
88+
},
89+
{
90+
"name": "hierarchy.lvl1",
91+
"type": "string",
92+
"facet": true,
93+
"optional": true
94+
},
95+
{
96+
"name": "hierarchy.lvl2",
97+
"type": "string",
98+
"facet": true,
99+
"optional": true
100+
},
101+
{
102+
"name": "hierarchy.lvl3",
103+
"type": "string",
104+
"facet": true,
105+
"optional": true
106+
},
107+
{
108+
"name": "hierarchy.lvl4",
109+
"type": "string",
110+
"facet": true,
111+
"optional": true
112+
},
113+
{
114+
"name": "hierarchy.lvl5",
115+
"type": "string",
116+
"facet": true,
117+
"optional": true
118+
},
119+
{
120+
"name": "hierarchy.lvl6",
121+
"type": "string",
122+
"facet": true,
123+
"optional": true
124+
},
125+
{ "name": "type", "type": "string", "facet": true, "optional": true },
126+
{
127+
"name": "docusaurus_tag",
128+
"type": "string*",
129+
"facet": true,
130+
"optional": true
131+
},
132+
{ "name": ".*_tag", "type": "string", "facet": true, "optional": true },
133+
{ "name": "language", "type": "string", "facet": true, "optional": true },
134+
{ "name": "tags", "type": "string[]", "facet": true, "optional": true },
135+
{ "name": "item_priority", "type": "int64" }
58136
]
59137
},
60138
"conversation_id": ["833762294"],

0 commit comments

Comments
 (0)