Skip to content

Commit 0a195e4

Browse files
committed
document the new command options and the new workflow
1 parent 071879e commit 0a195e4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

contributing/search.md

+35
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,41 @@ To sync the indices from your development environment:
2626
2. Run `npm run sync-search-dry-run`. This takes a while to complete. It will prepare, test, and validate all the indices without actually uploading anything to Algolia's servers.
2727
3. Run `npm run sync-search` to prepare the indices again and upload them to the Algolia servers.
2828

29+
## Build indices for a specific language and/or version
30+
31+
You can optionally build indices for a given language and/or a version. This is much faster than building all the indices.
32+
33+
You can build them as a dry run, which creates the index locally but does not upload them to Algolia. For example:
34+
```
35+
VERSION='free-pro-team@latest' LANGUAGE='en' npm run sync-search-dry-run
36+
```
37+
Or you can build and load them to Algolia to make them live:
38+
```
39+
VERSION='free-pro-team@latest' LANGUAGE='en' npm run sync-search
40+
```
41+
The `VERSION` env var must be a currently supported version in `<PLAN@RELEASE>` format. The `LANGUAGE` env var must be a currently supported two-letter language code.
42+
43+
### Label-triggered workflow
44+
45+
For our daily shipping needs, the indices are synced to Algolia only after a PR is shipped to the default branch, which means the search data isn't available for up to an hour after the content goes live.
46+
47+
But for GHES releases, we have additional needs. We want:
48+
49+
1) The search results to be live immediately upon releasing the new content.
50+
2) The search results to be previewable on the staging app the GHES release megabranch.
51+
52+
Manually running `npm run sync` locally before shipping the megabranch can address #1, but it's cumbersome and hard to get the timing right. And it does not address #2.
53+
54+
Now, docs team members can use an Actions workflow on GHES megabranch PRs by applying a label in this format:
55+
```
56+
sync-english-index-for-<PLAN@RELEASE>
57+
```
58+
This label will run a workflow on every push to **build and upload ONLY** the English index for the specified version. This means:
59+
60+
* The GHES content will be searchable at the same time the megabranch is shipped, with no delay.
61+
* The GHES content will be searchable on staging throughout content creation.
62+
* No manual steps (unless anyone wants to do a dry-run test as described in the previous section).
63+
2964
## Files
3065

3166
- [.github/workflows/sync-algolia-search-indices.yml](.github/workflows/sync-algolia-search-indices.yml) - the GitHub Actions workflow file that updates search indices whenever the main branch is updated.

0 commit comments

Comments
 (0)