Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

Commit 1ed18e1

Browse files
heiskrJamesMGreene
andauthored
Clear out some non-fn references to Algolia (github#20592)
* Clear out some non-fn references to Algolia * Update .github/workflows/dry-run-sync-search-indices.yml Co-authored-by: James M. Greene <[email protected]> * Update contributing/search.md Co-authored-by: James M. Greene <[email protected]> Co-authored-by: James M. Greene <[email protected]>
1 parent 42a0797 commit 1ed18e1

File tree

13 files changed

+43
-43
lines changed

13 files changed

+43
-43
lines changed

.github/actions-scripts/enterprise-algolia-label.js renamed to .github/actions-scripts/enterprise-search-label.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const eventPayload = JSON.parse(await fs.readFile(process.env.GITHUB_EVENT_PATH,
77

88
// This workflow-run script does the following:
99
// 1. Gets an array of labels on a PR.
10-
// 2. Finds one with the relevant Algolia text; if none found, exits early.
10+
// 2. Finds one with the relevant search text; if none found, exits early.
1111
// 3. Gets the version substring from the label string.
1212

1313
const labelText = 'sync-english-index-for-'
@@ -19,18 +19,18 @@ if (!(labelsArray && labelsArray.length)) {
1919
}
2020

2121
// Find the relevant label
22-
const algoliaLabel = labelsArray
22+
const searchLabel = labelsArray
2323
.map((label) => label.name)
2424
.find((label) => label.startsWith(labelText))
2525

2626
// Exit early if no relevant label is found
27-
if (!algoliaLabel) {
27+
if (!searchLabel) {
2828
process.exit(0)
2929
}
3030

3131
3232
// Returns: [email protected]
33-
const versionToSync = algoliaLabel.split(labelText)[1]
33+
const versionToSync = searchLabel.split(labelText)[1]
3434

3535
// Store the version so we can access it later in the workflow
3636
setOutput('versionToSync', versionToSync)

.github/actions-scripts/enterprise-server-issue-templates/release-issue.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
- PLACEHOLDER
3535
```
3636
**Note:** All of the content in this file will be updated when the release notes are created in the megabranch including the filename `PLACEHOLDER.yml`. You can update the date or leave it as-is and wait to update it when the release notes are finalized.
37-
- [ ] Create the Algolia search indices for the new release:
37+
- [ ] Create the search indices for the new release:
3838
```
3939
npm run sync-search-ghes-release
4040
```
@@ -51,7 +51,7 @@
5151
```
5252
sync-english-index-for-<PLAN@RELEASE>
5353
```
54-
☝️ This will run a workflow **on every push to the PR** that will sync **only** the English index for the new version to Algolia. This will make the GHES content searchable on staging throughout content creation, and will ensure the search updates go live at the same time the content is published. See [`contributing/search.md`](https://github.com/github/docs-internal/blob/main/contributing/search.md) for details.
54+
☝️ This will run a workflow **on every push to the PR** that will sync **only** the English index for the new version. This will make the GHES content searchable on staging throughout content creation, and will ensure the search updates go live at the same time the content is published. See [`contributing/search.md`](https://github.com/github/docs-internal/blob/main/contributing/search.md) for details.
5555
5656
- [ ] In `github/github`, to create a new GHES release follow these steps:
5757
- [ ] Copy the previous release's root document to a new root document for this release `cp app/api/description/ghes-<LATEST RELEASE NUMBER>.yaml app/api/description/ghes-<NEXT RELEASE NUMBER>.yaml`.
@@ -79,7 +79,7 @@ If the `OpenAPI dev mode check / check-schema-versions` check fails with the fol
7979
#### `Node.js tests / test content` failures
8080
8181
If the `Node.js tests / test content` check fails with the following message, the `lib/enterprise-dates.json` file is not up-to-date:
82-
> FAIL tests/content/algolia-search.js ● algolia › has remote indexNames in every language for every supported GHE version
82+
> FAIL tests/content/search.js ● search › has remote indexNames in every language for every supported GHE version
8383
8484
This file should be automatically updated, but you can also run `script/update-enterprise-dates.js` to update it. **Note:** If the test is still failing after running this script, look at the dates for this release. If the date is still inaccurate, it may be an issue with the source at https://github.com/github/enterprise-releases/blob/master/docs/supported-versions.md#release-lifecycle-dates. If that is the case, manually update the dates in the `lib/enterprise-dates.json` file.
8585
@@ -94,4 +94,4 @@ This file should be automatically updated, but you can also run `script/update-e
9494
### 🚢 🛳️ 🚢 Shipping the release branch
9595
9696
- [ ] The `github/docs-internal` repo is frozen, and the `Repo Freeze Check / Prevent merging during deployment freezes (pull_request_target)` test is expected to fail. Use admin permissions to ship the release branch with this failure.
97-
- [ ] Once smoke tests have passed, you can unfreeze the repos by deleting the `FREEZE` secret in both the `github/docs-internal` and `github/docs` repos. To delete the secrets, click the repo **Settings** tab and then click **Secrets** in the left sidebar. Click **Remove** next to the `FREEZE` secret.
97+
- [ ] Once smoke tests have passed, you can unfreeze the repos by deleting the `FREEZE` secret in both the `github/docs-internal` and `github/docs` repos. To delete the secrets, click the repo **Settings** tab and then click **Secrets** in the left sidebar. Click **Remove** next to the `FREEZE` secret.

.github/workflows/dry-run-sync-algolia-search-indices.yml renamed to .github/workflows/dry-run-sync-search-indices.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: (Dry run) Algolia
1+
name: (Dry run) Search indexes
22

3-
# **What it does**: On request, dry run Algolia to check for issues with search indexing.
3+
# **What it does**: On request, dry run to check for issues with search indexing.
44
# **Why we have it**: It helps us debug issues with search indexing.
55
# **Who does it impact**: Docs engineering.
66

.github/workflows/enterprise-dates.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Enterprise date updater
33
# **What it does**: Runs on a schedule to update lib/enterprise-dates.json.
44
# **Why we have it**: The lib/enterprise-dates.json file needs to be up-to-date
55
# for the .github/workflows/open-enterprise-issue.yml workflow and the
6-
# tests/content/algolia-search.js test.
6+
# tests/content/search.js test.
77
# **Who does it impact**: Docs engineering, docs content.
88

99
on:

.github/workflows/sync-algolia-search-indices.yml renamed to .github/workflows/sync-search-indices.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Algolia
1+
name: Sync search indexes
22

33
# **What it does**: This updates our search indexes after each deployment.
44
# **Why we have it**: We want our search indexes kept up to date.
@@ -40,4 +40,4 @@ jobs:
4040
channel: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
4141
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
4242
color: failure
43-
text: The last Algolia workflow run for ${{github.repository}} failed. Search actions for `workflow:Algolia`
43+
text: The last search index workflow run for ${{github.repository}} failed. Search actions for `workflow:search`

.github/workflows/sync-single-english-algolia-index.yml renamed to .github/workflows/sync-single-english-index.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Algolia Sync Single English Index
1+
name: Sync Single English Index
22

33
# **What it does**:
44
# **Why we have it**:
@@ -31,9 +31,9 @@ jobs:
3131
cache: npm
3232
- name: Install dependencies
3333
run: npm ci
34-
- name: Get version from Algolia label if present; only continue if the label is found.
34+
- name: Get version from search label if present; only continue if the label is found.
3535
id: getVersion
36-
run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-algolia-label.js
36+
run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-search-label.js
3737
- if: ${{ steps.getVersion.outputs.versionToSync }}
3838
name: Sync English index for single version
3939
env:

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ COPY --chown=node:node --from=builder /usr/src/docs/.next /usr/src/docs/.next
7777
# We should always be running in production mode
7878
ENV NODE_ENV production
7979

80-
# Use Lunr instead of Algolia
80+
# Hide iframes, add warnings to external links
8181
ENV AIRGAP true
8282

8383
# Copy only what's needed to run the server

contributing/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ Here, you'll find additional information that might be helpful as you work on a
1515
- [node versions](./node-versions.md) - our site runs on Node.js
1616
- [permalinks](./permalinks.md) - permalinks for article versioning
1717
- [redirects](./redirects.md) - configuring redirects in the site
18-
- [search](./search.md) - our search functionality is powered by [Algolia](https://www.algolia.com)
18+
- [search](./search.md) - our local site search functionality
1919
- [troubleshooting](./troubleshooting.md) - some help for troubleshooting failed and stalled status checks

contributing/search.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Overview
44

5-
This site's search functionality is powered by [Algolia](https://www.algolia.com), a third-party service.
5+
This site's search functionality.
66

77
To see all existing search-related issues and pull requests, visit [github.com/github/docs/labels/search](https://github.com/github/docs/labels/search).
88

@@ -14,7 +14,7 @@ To see all existing search-related issues and pull requests, visit [github.com/g
1414

1515
## How to search
1616

17-
The site search is part of every version of docs.github.com. This endpoint responds in JSON format, and fronts Algolia and Lunr. We recommend using this endpoint over directly integrating with Algolia or Lunr, as the endpoint will be more stable. On any page, you can use the search box to search the documents we've indexed.
17+
The site search is part of every version of docs.github.com. This endpoint responds in JSON format, and fronts our search querying functionality. We recommend using this endpoint, as the endpoint will be more stable. On any page, you can use the search box to search the documents we've indexed.
1818
You can also query our search endpoint directly at:
1919
`https://docs.github.com/search?version=<VERSION>&language=<LANGUAGE CODE>&filters=topics:<TOPIC>&query=<QUERY>`
2020

@@ -33,25 +33,25 @@ https://docs.github.com/search?version=dotcom&language=en&filters=topics:'oauth
3333

3434
### Using the topics search filter
3535

36-
Using the attribute `topics` in your query will only return results that have the matching topic value. The `topics` attribute is configured as a [`filter only` facet in Algolia](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/). When the topic contains spaces, you must use quotes. For Algolia, [here](https://www.algolia.com/doc/api-reference/api-parameters/filters/#handle-attributes-with-spaces) is an example for filters containing spaces. Algolia also requires [boolean operators](https://www.algolia.com/doc/api-reference/api-parameters/filters) to combine more than one filter.
36+
Using the attribute `topics` in your query will only return results that have the matching topic value. When the topic contains spaces, you must use quotes. Filters with spaces or combining filters requires special syntax.
3737

3838
## Production deploys
3939

40-
A [GitHub Actions workflow](.github/workflows/sync-algolia-search-indices.yml) triggered by pushes to the `main` branch syncs the search data to Algolia. This process generates structured data for all pages on the site, compares that data to what's currently on Algolia, then adds, updates, or removes indices based on the diff of the local and remote data, being careful not to create duplicate records and avoiding any unnecessary (and costly) indexing operations.
40+
A [GitHub Actions workflow](.github/workflows/sync-search-indices.yml) triggered by pushes to the `main` branch syncs the search data. This process generates structured data for all pages on the site, compares that data to what's currently on search, then adds, updates, or removes indices based on the diff of the local and remote data, being careful not to create duplicate records and avoiding any unnecessary (and costly) indexing operations.
4141

42-
The Actions workflow progress can be viewed (by GitHub employees) in the [Actions tab](https://github.com/github/docs/actions?query=workflow%3AAlgolia) of the repo.
42+
The Actions workflow progress can be viewed (by GitHub employees) in the [Actions tab](https://github.com/github/docs/actions?query=workflow%3Asearch) of the repo.
4343

4444
Because the workflow runs after a branch is merged to `main`, there is a slight delay for search data updates to appear on the site.
4545

4646
## Manual sync from a checkout
4747

48-
It is also possible to manually sync the indices to Algolia from your local checkout of the repo, before your branch is merged to `main`.
48+
It is also possible to manually sync the indices from your local checkout of the repo, before your branch is merged to `main`.
4949

50-
**Prerequisite:** Make sure the environment variables `ALGOLIA_APPLICATION_ID` and `ALGOLIA_API_KEY` are set in your `.env` file. You can find these values on [Algolia](https://www.algolia.com/apps/ZI5KPY1HBE/api-keys/all).
50+
**Prerequisite:** Make sure the environment variables `ALGOLIA_APPLICATION_ID` and `ALGOLIA_API_KEY` are set in your `.env` file. You can find these values on [Algolia](https://www.algolia.com/apps/ZI5KPY1HBE/api-keys/all). _Remove this paragraph when we switch to Lunr._
5151

5252
### Build without sync (dry run)
5353

54-
To build all the indices without uploading them to Algolia's servers (this takes about an hour):
54+
To build all the indices without uploading them (this takes about an hour):
5555
```
5656
npm run sync-search-dry-run
5757
```
@@ -65,11 +65,11 @@ Substitute a currently supported version for `<PLAN@RELEASE>` and a currently su
6565

6666
### Build and sync
6767

68-
To build all the indices and sync them to Algolia (this also takes about an hour):
68+
To build all the indices and sync them (this also takes about an hour):
6969
```
7070
npm run sync-search
7171
```
72-
To build indices for a specific language and/or version and sync them to Algolia:
72+
To build indices for a specific language and/or version and sync them:
7373
```
7474
VERSION=<PLAN@RELEASE LANGUAGE=<TWO-LETTER CODE> npm run sync-search
7575
```
@@ -95,17 +95,17 @@ Why do we need this? For our daily shipping needs, it's tolerable that search up
9595

9696
### Actions workflow files
9797

98-
- [`.github/workflows/sync-algolia-search-indices.yml`](.github/workflows/sync-algolia-search-indices.yml) - Builds and syncs search indices whenever the `main` branch is pushed to (that is, on production deploys).
99-
- [`.github/workflows/dry-run-sync-algolia-search-indices.yml`](.github/workflows/dry-run-sync-algolia-search-indices.yml) - This workflow can be run manually (via `workflow_dispatch`) to do a dry run build of all the indices. Useful for confirming that the indices can build without erroring out.
100-
- [`.github/workflows/sync-single-english-algolia-index.yml`](.github/workflows/sync-single-english-algolia-index.yml) - This workflow is run when a label in the right format is applied to a PR. See "[Label-triggered Actions workflow](#label-triggered-actions-workflow)" for details.
98+
- [`.github/workflows/sync-search-indices.yml`](.github/workflows/sync-search-indices.yml) - Builds and syncs search indices whenever the `main` branch is pushed to (that is, on production deploys).
99+
- [`.github/workflows/dry-run-sync-search-indices.yml`](.github/workflows/dry-run-sync-search-indices.yml) - This workflow can be run manually (via `workflow_dispatch`) to do a dry run build of all the indices. Useful for confirming that the indices can build without erroring out.
100+
- [`.github/workflows/sync-single-english-index.yml`](.github/workflows/sync-single-english-index.yml) - This workflow is run when a label in the right format is applied to a PR. See "[Label-triggered Actions workflow](#label-triggered-actions-workflow)" for details.
101101

102102
### Code files
103103

104104
- [components/lib/search.ts](components/lib/search.ts) - The browser-side code that enables search.
105-
- [lib/search/algolia-client.js](lib/search/algolia-client.js) - A thin wrapper around the [algoliasearch](https://ghub.io/algoliasearch) Node.js module for interacting with the Algolia API.
106-
- [lib/search/algolia-search-index.js](lib/search/algolia-search-index.js) - A class for generating structured search data from repository content and syncing it with the remote Algolia service. This class has built-in validation to ensure that all records are valid before they're uploaded. This class also takes care of removing deprecated records, and compares existing remote records with the latest local records to avoid uploading records that haven't changed.
107-
- [script/sync-search-indices.js](script/sync-search-indices.js) - The script used by the Actions workflow to update search indices on our Algolia account. This can also be [run in the development environment](#development).
108-
- [tests/algolia-search.js](tests/algolia-search.js) - Tests!
105+
- [lib/search/client.js](lib/search/client.js) - A thin wrapper around the Node.js module for interacting with the search API.
106+
- [lib/search/search-index.js](lib/search/search-index.js) - A class for generating structured search data from repository content and syncing it. This class has built-in validation to ensure that all records are valid before they're uploaded. This class also takes care of removing deprecated records, and compares existing remote records with the latest local records to avoid uploading records that haven't changed.
107+
- [script/sync-search-indices.js](script/sync-search-indices.js) - The script used by the Actions workflow to update search indices. This can also be [run in the development environment](#development).
108+
- [tests/content/search.js](tests/content/search.js) - Tests!
109109

110110
## Indices
111111

@@ -144,7 +144,7 @@ Each record represents a section of a page. Sections are derived by splitting up
144144

145145
## Notes
146146

147-
- It's not strictly necessary to set an `objectID` as Algolia will create one automatically, but by creating our own we have a guarantee that subsequent invocations of this upload script will overwrite existing records instead of creating numerous duplicate records with differing IDs.
148-
- Algolia has typo tolerance. Try spelling something wrong and see what you get!
149-
- Algolia has lots of controls for customizing each index, so we can add weights to certain attributes and create rules like "title is more important than body", etc. But it works pretty well as-is without any configuration.
150-
- Algolia has support for "advanced query syntax" for exact matching of quoted expressions and exclusion of words preceded by a `-` sign. This is off by default but we have it enabled in our browser client. This and many other settings can be configured in Algolia.com web interface. The settings in the web interface can be overridden by the search endpoint. See [middleware/search.js]([middleware/search.js).
147+
- It's not strictly necessary to set an `objectID` as the search index will create one automatically, but by creating our own we have a guarantee that subsequent invocations of this upload script will overwrite existing records instead of creating numerous duplicate records with differing IDs.
148+
- Our search querying has typo tolerance. Try spelling something wrong and see what you get!
149+
- Our search querying has lots of controls for customizing each index, so we can add weights to certain attributes and create rules like "title is more important than body", etc. But it works pretty well as-is without any configuration.
150+
- Our search querying has support for "advanced query syntax" for exact matching of quoted expressions and exclusion of words preceded by a `-` sign. This is off by default but we have it enabled in our browser client. The settings in the web interface can be overridden by the search endpoint. See [middleware/search.js]([middleware/search.js).

lib/search/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const maxContentLength = 5000
33
export const namePrefix = 'github-docs'
44

55
export default {
6-
// records must be truncated to avoid going over Algolia's 10K limit
6+
// records must be truncated to avoid going over 10K limit
77
maxRecordLength,
88
maxContentLength,
99
namePrefix,

middleware/csp.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default function csp(req, res, next) {
4747

4848
const { requestedVersion } = isArchivedVersion(req)
4949

50-
// Exception for Algolia instantsearch in deprecated Enterprise docs (Node.js era)
50+
// Exception for deprecated Enterprise docs (Node.js era)
5151
if (
5252
versionSatisfiesRange(requestedVersion, '<=2.19') &&
5353
versionSatisfiesRange(requestedVersion, '>2.12')

script/search/rank.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
// This module accepts an Algolia search record object as input and
2+
// This module accepts a search record object as input and
33
// returns a ranking score which influences how results are sorted.
44

55
// higher in this list == higher search ranking

tests/content/algolia-search.js renamed to tests/content/search.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { namePrefix } from '../../lib/search/config.js'
44
import remoteIndexNames from '../../lib/search/cached-index-names.json'
55
const languageCodes = Object.keys(xLanguages)
66

7-
describe('algolia', () => {
7+
describe('search', () => {
88
test('has remote indexNames in every language for every supported GHE version', () => {
99
expect(supported.length).toBeGreaterThan(1)
1010
supported.forEach((version) => {

0 commit comments

Comments
 (0)