1
0
mirror of synced 2025-12-30 03:01:36 -05:00

Merge branch 'main' into codewithdev-ui-changes

This commit is contained in:
Steve Ward
2022-10-04 16:03:14 -04:00
committed by GitHub
87 changed files with 238 additions and 186 deletions

View File

@@ -27,10 +27,26 @@ concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
env:
ELASTICSEARCH_URL: http://localhost:9200/
jobs:
build:
runs-on: ${{ fromJSON('["ubuntu-latest", "ubuntu-20.04-xl"]')[github.repository == 'github/docs-internal'] }}
steps:
- name: Install a local Elasticsearch for testing
# For the sake of saving time, only run this step if the test-group
# is one that will run tests against an Elasticsearch on localhost.
uses: getong/elasticsearch-action@95b501ab0c83dee0aac7c39b7cea3723bef14954
with:
# Make sure this matches production and `sync-search-pr.yml`
elasticsearch version: '7.11.1'
host port: 9200
container port: 9200
host node port: 9300
node port: 9300
discovery type: 'single-node'
- name: Checkout
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
with:
@@ -62,5 +78,12 @@ jobs:
- name: Run build script
run: npm run build
- name: Index fixtures into the local Elasticsearch
run: npm run index-test-fixtures
- name: Check that Elasticsearch is accessible
run: |
curl --fail --retry-connrefused --retry 5 -I ${{ env.ELASTICSEARCH_URL }}
- name: Run browser-test
run: npm run browser-test

View File

@@ -16,14 +16,16 @@ import { Link } from 'components/Link'
import styles from './Search.module.scss'
// This is a temporary thing purely for the engineers of this project.
// When we are content that the new Elasticsearch-based middleware can
// wrap searches that match the old JSON format, but based on Elasticsearch
// behind the scene, we can change this component to always use
// /api/search/legacy. Then, when time allows we can change this component
// to use the new JSON format (/api/search/v1) and change the code to
// use that instead.
const USE_LEGACY_SEARCH = JSON.parse(process.env.NEXT_PUBLIC_USE_LEGACY_SEARCH || 'false')
// The search endpoint used prior to using /api/search/legacy was
// just /search, which used middleware/search.js. We are leaving that
// middleware in tact to allow folks that previously used the /search
// endpoint to continue doing so. But, we changed the endpoint used by
// the search input on docs.github.com to use the new /api/search/legacy
// endpoint.
// Eventually, we will deprecate the /search and /api/search/legacy
// endpoints and use the /api/search/v1 endpoint, which has
// a different response JSON format.
const SEARCH_API_ENDPOINT = '/api/search/legacy'
type SearchResult = {
url: string
@@ -67,7 +69,7 @@ export function Search({
: 'en'
const fetchURL = query
? `/${USE_LEGACY_SEARCH ? 'api/search/legacy' : 'search'}?${new URLSearchParams({
? `${SEARCH_API_ENDPOINT}?${new URLSearchParams({
language,
version,
query,

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:975556001be97233865a63f0d4adc96a1645e03f02f9a24328c00a7bd8abe934
size 786802
oid sha256:3f94540c14068b07741b4d39144f52483301709613c59e82cdf46b1e81087a1c
size 786825

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:962d44048f87413e2b85ebc3bc342dc8d9df0ea8d96015227ffaf21b5bec2e02
size 1533032
oid sha256:a469c2a552aea14ca323bb195680222b451561b0d00b8081f7d0e1fbce249fbb
size 1532883

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1e57cb4a411c9d03c5aaf8122f7f65e5832bd8b0da53e2657c07339217dc260a
size 1102078
oid sha256:0b410a55c1e2da4b893bcc1eb7fbcc704fca57b623a6f9bd4a77ca2e6801b87b
size 1104057

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b28ebbdbe82a04b46807c69a63933c7588a87e07f80a6262d544065b3c29b323
size 4468106
oid sha256:5b4d8f299b1c69f088263deee33d8b1516d304f6313371cc11c4f24bf4bcbbb3
size 4474824

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:00d9644118a6b5add57d38b086a450e5155a571af11d7555fc3ad2fc5b201b6f
size 740932
oid sha256:d34d4f784ecd2959aba205175cad0cd0d7d401254abf2934a43030261550e5d4
size 740993

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:29b9141739c240e2653b9caeb93841cc5712549d06b3b44b08e16c5bb258a709
size 3089234
oid sha256:4148a89817a2abbcceb95e0ec24d23d5037a119883970fe37430e1c6b27873e9
size 3089413

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b1bb3feff87da2c29c89eaf2112a38c482d8aeb5268c2f38d698a94697112dce
size 829198
oid sha256:e9550ffe6b4bfddda78bdcf275b678e7fc84306e44b4ee9f9d90fbd8ce25fccd
size 829111

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b36825599eb6bee153e1a8c656e887b7edf79985118c829b8a763c33781461c4
size 4378805
oid sha256:f0b27fb371aba520e60704a5ec547fdc32ae855aaee04bc493319237138100fd
size 4379113

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5efc4a703bcd3e71901324e94d85ea6ce95108909eadd72ba2100ff034f781df
size 727315
oid sha256:0a07a94d5ab54ffb862f37dfe3c4fe6242673a71d81c30c06e584e3026004ed9
size 727339

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ebf7d37ec017919c80af64598e3491c9a8803a1df96b3d646a94c7325ee6e604
size 3073005
oid sha256:8b0b91e67607333d396bf9938c67a96ea3c029da3c1301987044879157171731
size 3072490

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a4758a07213f26fddb530d2c06f44b331b331217b6487c394479d96032fd133e
size 811527
oid sha256:066358dabc11cad7142e179bf51042191fe3956db8d62275ba94e3379862b7a0
size 811552

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fca4d22531f809cbbfc46d3473245fb0ee91e6f9d3a5555e566287f3d13d157c
size 1587151
oid sha256:b3a7824c96ef952d043010ad66fea3f4b428a3dd1c560b28f594ab9089963225
size 1587396

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:15e91419dbbd1ba89a2aef2cf4d86efe5d72cdd5088e3af3428502f23b716e95
size 1137314
oid sha256:8f69fc801e06274fd87d38076bd01bc577d54e88fd52ce5d81c05b64bce009c9
size 1140044

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:29516360456cfb13f7bb51c8cfd1eb432b297766bb6468b7ede42538fd2a63a0
size 4572508
oid sha256:dfbfe4d623d6a0a95ececf544669e7b8e58112e3a9c7ad99cada100080737082
size 4580517

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:45f3ebf0bde8c15dff516cbc466961bb7c1439c06a9eece34c8a572284ae94c2
size 762737
oid sha256:abe86fdee7f5aa152ce7037a08ddb80f604a644b8f54c4e5f05ad24d8bb7f509
size 762745

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b0fc4c57857a0c9d8ca01d472f27136698a0c4ec15aef6ff42ff78056f8d3504
size 3183139
oid sha256:d357d8021f707c584ab448c5b186e5eb461bdeed3f6266550ead631d051924dc
size 3183191

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:783c79915657351a4410542738a59dff4d518ef462a55e65ff80ddfa43f96fbe
size 853258
oid sha256:58d381e066827a8a2400fd1e796ea7463940bd3c28864c8d9f975e6130acd992
size 853297

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0905ab48e53545663d3f524efa6388e07ba3fd5a129fe2658befdef4b5a0bb05
size 4509900
oid sha256:aa0119f9c5346d9ef2114aa043cca241f5df2fbd4f930f40b84eefa9ffd584df
size 4509770

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:626b4d5de84f0ace5ec914440137b28263b6957d1b5fad716b17890186942cd3
size 749340
oid sha256:d2560499615a578e571c3132711c7bdd6b42358fbad1567f339fe495704f0494
size 749515

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:82eb51532306a636b66a8686f4901eee0bd5896f9dbfd1a3740c6f8e52bae500
size 3167073
oid sha256:10d547be92ee8c8288b82567a8f4fc1175822e1977bc9430db0955a4bbb11057
size 3166777

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:62dfb3820fa483f7d911ef36e844caeb5bf581e4173f6b7d809d98b63855eef0
size 813665
oid sha256:e7605781366fdefbad20c287f2d7c0f0eef3e54e1a08cd6b80eb67fc10f4cf10
size 813696

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:15f27ab06def1f8a02fae2dedee07005784f8e674cc1ad921ed5c087d464918a
size 1599721
oid sha256:70d53da0200bf91793f38073f8d4622b04eedf4c9b132562ec5b493baab9c0c7
size 1599464

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9fdd00da18ec8c8792b31dd9ca76a4bb7e58cb1f5f502dca0b114630b623bdfd
size 1149291
oid sha256:fae97c6703475347e9c8441860b9969583375bae2ae6230f603255952226b74a
size 1151514

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ea598c537058a0d72184a1197511b918cf130fcfae3c528d92f6d3e10f988dad
size 4633090
oid sha256:55f9cefcb65851ff2d05f9667e9a556969126bbdfdadb4899b89263eb33af472
size 4639840

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2ad6ef3969a7be4570f78578e3415e62e445698008b1764537e5d368874fe132
size 767007
oid sha256:cc438808e8d0334183ae446bbc44149bdc9f81c655bfd639c0bfa7d652a36399
size 767092

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0c65596433287643150525715d5c13f9028821a9f379cce5d843b870a9bb4a7b
size 3209483
oid sha256:05e6e3ec4bc392cc428447a23ba63238010270c8c30b5ebf1182e45381cf1216
size 3209516

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f3256260e3d6bb5e98873b5c4c84f103c7ed12c2244cfcb322fce8d20d9007ee
size 855634
oid sha256:e61f401101246b97742df087198cb4c840e981f6fad85f5fae450f50e325c7ac
size 855645

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c923c202d948f830ad1e0c6dd6fe45b0ce7df79d52812bcce38332aa485d6a83
size 4536954
oid sha256:e3de6747bc73997bbea02365a4614e9e84dde0ffb1362baae6d8f7a7fdc48100
size 4537286

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:66d23a4ed4272c5fc57d48f8174f6d3cc82cdedfad1723982d4774188312560b
size 753710
oid sha256:6296c3e54c46b7310fd8288c3d5c7286e63a3961f61edffbbf71bad75a0b2d2b
size 753746

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0edbf0cc777277754109919c7f300e3b4a62925e3f8c72559268499f165e5e0d
size 3193263
oid sha256:b21dea222488da946b5bb3cf007088393f9b3b84e1f4eb679e51db008bc9071c
size 3193340

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:72e30f2844f5fc9bde561a1e3f14fcdc8752b2c74c9314bc54938f06f2c62d5f
size 844303
oid sha256:91a0a392d817a9d4a8bfa87d5f38df627b91213b1331437be392d2e5b8f5f7a5
size 844374

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6a15636ac263c712d32a3925e07e780af346c5514289742be9c169bb9195ac82
size 1661212
oid sha256:407bb9541c2091131bd984369d1abfb7331d08ae7b75f1011080010050ce950a
size 1661106

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ca34afc0aa3ff1494d53fbfe216fd1cc514da38c8705780dc13fd85bceb16828
size 1190211
oid sha256:a50e4d2d694fb59ba0f041c8b37eaaae650089929b5bb2b3ab54929c86ee96fc
size 1192180

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c29034793482077863fd531ba8d77f8ff0527eaf258568a795dae99ca62aa1ac
size 4800073
oid sha256:986b66d6d69719b7614f11d067d77dd91b07b42fd396edf8ef6643deb9eca9de
size 4808744

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d8c9ed8de7beaec636f000dfa79c92b517a293379a6aad872aa8a7d3276444e5
size 792055
oid sha256:5821570b8a62f1296c47bb638cf61ec8b0133b318000e897af376489a7d25f63
size 792135

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d018c753eac2f44d80b1399676ba3dca8a3f6cf9dbc5c53b7806dfd739f39d1e
size 3324711
oid sha256:e8389f5f1856f5282c239977cb135f57287b08a6a4d802538b2f5d5b9d2fd0bd
size 3324373

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d3c6f1c012a33f92de2b3cdfd7ba7cbef788bd91f92aec1c43350761621f8cf1
size 886033
oid sha256:5203d19acce1da54b08b35fefbc2afe038e89e834c85d38611f126085992ad5c
size 885899

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:278fca85797d575d8d826fbc9d2b5883819db5a14fc21e6b18b79e572d12f191
size 4708240
oid sha256:bb7454d856e88b0f1f26c4633e340819722e1158adab81e1a59d38a8e6461f80
size 4707842

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7e66142a3c4317d0654a85c74799a8663a21018b9703f86df8589a34d7de0941
size 778594
oid sha256:f2774438722eb032e5ea3e3b9fe8cff202da188d0e365900a740026f275b94f7
size 778624

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d20bd758a2addb8c619c3b297e5a593c9fe8ca9c57e91f6d8bbfd1ffed84fe2a
size 3307995
oid sha256:3b3f8d71e776438bd73d0e6ff4b1b5ffdf2b51d48da166660913854de9f493e7
size 3308531

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad0ddc8bc6af92c764820160520ceb5991ec0d8605bb9e2654ed51dd9d87e904
size 866776
oid sha256:14f46077e8b512b85949c2cb2562a8fa3d6273d19305b616e85c5ba5a2074ff0
size 866813

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:35022b7a2f91f5dd1ce498ae0708759973af3f7d8ef12c87530f68cd97512531
size 1702993
oid sha256:08bb8ba5d696f4bc87fad82b649081fcd57324e00a6b688992165c0eb5dffb52
size 1702582

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:416c1b719864076c3a728e36b81ceddcfe34c3cb89561e08f5467759b112f84c
size 1223219
oid sha256:8a2c27a2a9f09c9f9d873a9e68d464f88a6e8a0232d4e6463b2d963dc6a55b99
size 1224908

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:02cbb26b94afaf2eb1f3af1cd0ad0c032f68599744c3701d93e1a62be78b2c8b
size 4933074
oid sha256:976ff64d84b51419ffb1cc1c5ac090bdf5fa9450aa554e1c6db2975d88db9f4a
size 4940771

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f05a37a96c3a41ce0df09334a7a2536cf2d58a373e6af44529031836c86d2e92
size 814608
oid sha256:58448299a1a6278b5115053658d1046dbd416d3112baebba5c929c6aa1e388f4
size 814584

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1b9a4e9bbcdcbf4e72b137f063706eca1491bc1bba91925098693e7e77334fbc
size 3426567
oid sha256:b83320cc28ffcb73510ceb8bb35e63e2af20c2b3dedfe3786b764886b0def180
size 3426484

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ab6e8a5b1ce2ffc06dee18e91f33673381f5e78b32fcd9fca8e661699222acc7
size 911435
oid sha256:5827f5aa4dd03486f3914c3c84cf37d8a1001aa3a03988b172779bc1675456cd
size 911573

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ae9d41b3cebc84961de59070cc8d58f7b56f51bdb39565896e7b8daec1514658
size 4848086
oid sha256:b04da9123ff770d65ad1d5e5c2a756ea55b6afc06b97446f6a651706402a29c7
size 4847859

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2cae46817ece915b557e9b723283aeb9c22cbf3f3aefa251e2aa8f557965ddfd
size 800650
oid sha256:f739bd28595d1cdd6a1366926401caf1412e938722b1862e0d8ef677f2e0a0bc
size 800630

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:92f2ea69e2f8250097bd9c5e97bb82e595f8397e796f6310aef6e5972298400e
size 3408740
oid sha256:892e2242c46965e36e8c98d94cba28ba3170ee6dfd427785f5318962c7efd91b
size 3408629

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fffc495b2e984941b6b1d1bb462a263de82657202da9ae4bb8d7707687b84601
size 1014887
oid sha256:64f87329f2460a6db7cc6f3f253d966995f24ba5a151cf3333c36fd7839d3dfe
size 1014474

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7a53ca5540ff164e028e536fda0f947ef21a6c1cada912cb803cface9af54522
size 1804068
oid sha256:c9ccc3dfdc7360a01734215f1a235ac5be0f1126f97191e7a96c1135cb129374
size 1803591

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:18c27dd78293a326d7bb444b518a0ac2a73695acc169a63132c33f457e1ece3a
size 1473828
oid sha256:828daff13409c95c2e4060b158e6150b9d87b6f98fe62cb54b73351bebe0f078
size 1475864

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cb0de891d7c1659f2325415c5383b89c80c785483e80d190116a796049f71676
size 5684428
oid sha256:9679afa4ec9cb1b58f34e8ffc098244e1425c86398adee02394e5199f6e7ecd9
size 5690507

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dcba75500492362b0acafa1d2c1d63574140ab4479e519d39839157bcad29d74
size 944750
oid sha256:82ac233a31902c4769e5537f331cf6a0e88b57f685d2989f19ddb9049979d5cf
size 944818

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:be6e228fff4681fb5dd5e1851cd81912bc2364985d73a5c451bf08a848ab0db2
size 3899229
oid sha256:c23f6a8e56f4458d045436b8a9ac929738330ce0dd27c3f2b11e76f4f3de6354
size 3899521

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b2eee0607cf92eb8a09be1a2e1c5529a95a0b38437fdd322b57efd8ef584bfbf
size 1064552
oid sha256:081c8598bfa77026e68dfa2606c4a2bb06a093ede9daebb46c46e0b2b5ff7714
size 1064715

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:327cd60778f696b0ef888635384b3c40352ee044bbccdf2b68f73892a8503bc6
size 5508764
oid sha256:1515cdf5bbb239e81863fdb933a889f32ce5f517d5e74b686167359da62c1d53
size 5508839

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:003182413388f9b33eacbf95f0d88dcb8f905cdc3e25d7f9107ae0465169d966
size 927373
oid sha256:a57886e384a25ce3606a67a5f3061f31b1631eb274f3449b9748b4edcbe0300a
size 927385

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0bdaf8bf6b12e5f57366da114d473e548f0dfe7ab4bd117c65663bc1fcfa8403
size 3856063
oid sha256:638d03445c3d8aa3118f7c58475df035a9ff6658128344c8808eaa86a9dd7468
size 3856338

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b9642a8ba0e6b596e604f2d249962fa3841899f269d277d38ad8824e9ad80cce
size 652040
oid sha256:aae2e526bb07514aa0571a4df2be9ae96f735b9bc9d117dbb7a7936104bb1f58
size 652072

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bcd791d39d22ea188755d16a0d03ae92d67c7216a704f73653067bee15c00e98
size 1288140
oid sha256:abb48b43baf41a2b6838215c0da02d7dbba9cef2adc6d3db7940fbfb15c18cc1
size 1288439

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:09d0a47a75d61dc190bc8d119c17c3db2be4cbb4e701d870daac7ad75992ed8f
size 947635
oid sha256:24d33cf7385eb48c84cf2c59797c94d9d1b7a3f885d15c36946f2f9cae6b486f
size 953686

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6c817637d44ae063f51fd1c8990ba4f98e179e82cc93af1b544f098555dbdeea
size 3759200
oid sha256:4602f19106bb56bc55ce5424bfabf9a29dac0bcf19e1104a7e41016375671a52
size 3764701

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8778e31ba828e7e364d3f076cbd7b6325d90fd34dd64243a70d0f31d8b954fdc
size 622655
oid sha256:582709bdddfad9aca9dd56cf7623b2150bcfe1aa53bb10e562e3479a02a62d7a
size 622631

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0bdfc766823e2b8191add0e06a855f87cfb176b5ab8fc1f4ff65994cb2bb7e5c
size 2524874
oid sha256:e93d98fa947248bce494e49dd1346339b7032ad8a0ad00cae8efd7dc8795a50c
size 2524430

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ef3ce1cf8a6ea7d6f2fb117ee4119ce7d32108ab26062d04d4a76490b0c83f53
size 685578
oid sha256:e54ab0d155128de21fa1ed2d1297d07f02ff82500ce107e4c63e8989fdb3571e
size 685558

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b477dce3158f886b43c850b8a1f8703d84394bf83f1880071dadab23dd5d2571
size 3542324
oid sha256:f4c5ddc8b067780bee05fc33d6e2103f0b57ab5e72b6eabebcd0dfac58840c54
size 3542558

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dbbd3f258f69943ff003f4697e400b456ababdd37960fa76cd855f8d2528c050
size 611806
oid sha256:06cbd21d6e7336584d35b3c27e6e6538271b8698bb827a242fe9d9c6a8954405
size 611995

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:38a500515d0ccf5627ae34a8fda404991ce3d2974947fd0b96e210c1cbfb08c3
size 2512699
oid sha256:e827c289f4fe9d232dc81eb62f488a54f33b9ec0abc8ec05ce02d843773912bd
size 2513841

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e9413f074e93087d787ec5648c58b06ab37f1a1604657316791bb460626f687f
size 996722
oid sha256:a3e9c957daa57abf332ad8041201fa434fad36a4d326b4fd68e9d6aebd010595
size 996788

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bba9a466e579aa3ade75368e2b7d28708b2458e58858d7dcac113ea9cf78b896
size 1946415
oid sha256:558ebca15fed53303b56a20c0b549ca66ff084c443e02b68824e97401e6c2a7f
size 1946320

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:23f83f27df9198e3b8b325bccff2f669d50815cd03e91f6f3dacf65a4dc7750a
size 1412281
oid sha256:48dcb09ae4d501a9aa7ad4e60da78c5224ec211a4b0b21c416eb4fdf180ad652
size 1414253

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5fea82f0afce0b4e269756a14840a0fbe33a93ed9d001fd2eeb737c83bbed036
size 5747022
oid sha256:7e3b7539d049bde43dd1cbaa6f8239b9137281fd7ad0880800bab9e84b114a41
size 5752613

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8014e68152e5d6fff96086dae008175b872d38aa3de5de0f4d9a70c2349e42da
size 948943
oid sha256:e1f9aaf9818308eecece95db0123c1fc6ca680cf0f9689a7d29a1bc2a057c581
size 948995

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:11ae9f27b4b2712920c186e2367736b54b542a42ce882b6e65326e19a1d98b21
size 4058862
oid sha256:48de9543ad5b6371a1c19c4070d4e4d7493588b274ff6e5bac8161191c371a9d
size 4059079

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:975592673c152bca132cf00961fea0a35ae8465332447d3ed1ac3494a81d2a16
size 1054911
oid sha256:b53477282e48e38a6b967d248d766d34e75846e93b552fb78509b8e59981cef1
size 1055025

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:558d5f60e2e7d47faec15354a81a71ffb5e159f52f5cd2a9044b14c47931df25
size 5652222
oid sha256:be167cc3a4bddb8de466bfc86ab0b5a00f31b473f8fca2c8385ba30bb3ff48b3
size 5652677

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c918d971b1b5deb6f91ce32b1bd6dec6e7159afd623fe6558ab02ef90f970776
size 931629
oid sha256:8fa89094e26ab78be33ebba99966d9c5818220bff7693861f96ae571fa5b77c0
size 931632

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2d783c51b28be2e31be09fbd0b8f87c22d80e0a8a49ef25a2b31cca5d8ceaa0f
size 4008931
oid sha256:60da49c77b85b144be723f6865284bd1fc37ea08cbd2da58228f5fe7c7abec8b
size 4008674

View File

@@ -26,8 +26,10 @@ export default async function buildRecords(
indexablePages,
pageVersion,
languageCode,
redirects
redirects,
config = {}
) {
const { noMarkers } = config
console.log(`\n\nBuilding records for index '${indexName}' (${languages[languageCode].name})`)
const records = []
const pages = indexablePages
@@ -61,12 +63,12 @@ export default async function buildRecords(
const waiter = domwaiter(permalinks, { maxConcurrent: MAX_CONCURRENT, minTime: MIN_TIME })
.on('page', (page) => {
process.stdout.write(pageMarker)
if (!noMarkers) process.stdout.write(pageMarker)
const newRecord = parsePageSectionsIntoRecords(page)
const pathArticle = page.relativePath.replace('/index.md', '').replace('.md', '')
const popularity = (hasPopularPages && popularPages[pathArticle]) || 0.0
newRecord.popularity = popularity
process.stdout.write(recordMarker)
if (!noMarkers) process.stdout.write(recordMarker)
records.push(newRecord)
})
.on('error', (err) => {

View File

@@ -32,6 +32,11 @@ export default function parsePageSectionsIntoRecords(page) {
const rootSelector = '[data-search=article-body]'
const $root = $(rootSelector)
if ($root.length === 0) {
console.warn(`${href} has no '${rootSelector}'`)
} else if ($root.length > 1) {
console.warn(`${href} has more than one '${rootSelector}' (${$root.length})`)
}
const $sections = $('h2', $root)
.filter('[id]')

View File

@@ -49,6 +49,7 @@ program
// and change where it's used to be that the default is to not generate
// any Lunr indexes.
.option('--no-lunr-index', `Do not generate a Lunr index, just the records file (default false)`)
.option('--no-markers', 'Do not print a marker for each parsed document')
.parse(process.argv)
main(program.opts())
@@ -128,6 +129,10 @@ async function main(opts) {
const generateLunrIndex = !!opts.lunrIndex
const config = {
noMarkers: !opts.markers,
}
const options = {
dryRun,
language,
@@ -136,6 +141,7 @@ async function main(opts) {
outDirectory,
compressFiles,
generateLunrIndex,
config,
}
await searchSync(options)
}

View File

@@ -19,6 +19,7 @@ export default async function syncSearchIndexes({
outDirectory,
compressFiles,
generateLunrIndex,
config = {},
}) {
const t0 = new Date()
@@ -72,7 +73,8 @@ export default async function syncSearchIndexes({
indexablePages,
pageVersion,
languageCode,
redirects
redirects,
config
)
if (generateLunrIndex) {
const index = new LunrIndex(indexName, records)

View File

@@ -13,6 +13,8 @@ describe('homepage', () => {
})
})
// Note, we can only test Elasticsearch searches on things we have indexed
// in the fixtures. See the contents of /tests/content/fixtures/search-indexes/
describe('browser search', () => {
jest.setTimeout(60 * 1000)
@@ -20,10 +22,10 @@ describe('browser search', () => {
await page.goto('http://localhost:4000/en/actions')
await page.click('[data-testid=mobile-menu-button]')
await page.click('[data-testid=mobile-header] [data-testid=site-search-input]')
await page.type('[data-testid=mobile-header] [data-testid=site-search-input]', 'workflows')
await page.type('[data-testid=mobile-header] [data-testid=site-search-input]', 'foo')
await page.waitForSelector('[data-testid=search-results]')
const hits = await page.$$('[data-testid=search-result]')
expect(hits.length).toBeGreaterThan(5)
expect(hits.length).toBeGreaterThan(3)
})
it('works on desktop landing pages', async () => {
@@ -31,10 +33,10 @@ describe('browser search', () => {
await page.setViewport({ width: 1024, height: 768 })
await page.goto('http://localhost:4000/en/actions')
await page.click('[data-testid=desktop-header] [data-testid=site-search-input]')
await page.type('[data-testid=desktop-header] [data-testid=site-search-input]', 'workflows')
await page.type('[data-testid=desktop-header] [data-testid=site-search-input]', 'foo')
await page.waitForSelector('[data-testid=search-results]')
const hits = await page.$$('[data-testid=search-result]')
expect(hits.length).toBeGreaterThan(5)
expect(hits.length).toBeGreaterThan(3)
await page.setViewport(initialViewport)
})
// 404 page is statically generated with next, so search is not available, but may possibly be brought back
@@ -48,7 +50,8 @@ describe('browser search', () => {
expect(hits.length).toBeGreaterThan(5)
})
it('sends the correct data to search for Enterprise Server', async () => {
// Elasticsearch fixtures only work for dotco and GHAE
it.skip('sends the correct data to search for Enterprise Server', async () => {
expect.assertions(2)
const newPage = await browser.newPage()
@@ -58,7 +61,10 @@ describe('browser search', () => {
await newPage.setRequestInterception(true)
newPage.on('request', (interceptedRequest) => {
if (interceptedRequest.method() === 'GET' && /search\?/i.test(interceptedRequest.url())) {
if (
interceptedRequest.method() === 'GET' &&
/api\/search\/legacy\?/i.test(interceptedRequest.url())
) {
const { searchParams } = new URL(interceptedRequest.url())
expect(searchParams.get('version')).toBe(oldestSupported)
expect(searchParams.get('language')).toBe('en')
@@ -75,17 +81,20 @@ describe('browser search', () => {
await newPage.waitForSelector('[data-testid=search-result]')
})
it('sends the correct data to search for GHEC', async () => {
it('sends the correct data to search for dotcom', async () => {
expect.assertions(2)
const newPage = await browser.newPage()
await newPage.goto('http://localhost:4000/en/enterprise-cloud@latest/admin/overview')
await newPage.goto('http://localhost:4000/en')
await newPage.setRequestInterception(true)
newPage.on('request', (interceptedRequest) => {
if (interceptedRequest.method() === 'GET' && /search\?/i.test(interceptedRequest.url())) {
if (
interceptedRequest.method() === 'GET' &&
/api\/search\/legacy\?/i.test(interceptedRequest.url())
) {
const { searchParams } = new URL(interceptedRequest.url())
expect(searchParams.get('version')).toBe('ghec')
expect(searchParams.get('version')).toBe('dotcom')
expect(searchParams.get('language')).toBe('en')
}
interceptedRequest.continue()
@@ -96,7 +105,7 @@ describe('browser search', () => {
'[data-testid=mobile-header] [data-testid=site-search-input]'
)
await searchInput.click()
await searchInput.type('test')
await searchInput.type('foo')
await newPage.waitForSelector('[data-testid=search-result]')
})
@@ -108,7 +117,10 @@ describe('browser search', () => {
await newPage.setRequestInterception(true)
newPage.on('request', (interceptedRequest) => {
if (interceptedRequest.method() === 'GET' && /search\?/i.test(interceptedRequest.url())) {
if (
interceptedRequest.method() === 'GET' &&
/api\/search\/legacy\?/i.test(interceptedRequest.url())
) {
const { searchParams } = new URL(interceptedRequest.url())
expect(searchParams.get('version')).toBe('ghae')
expect(searchParams.get('language')).toBe('en')
@@ -121,7 +133,7 @@ describe('browser search', () => {
'[data-testid=mobile-header] [data-testid=site-search-input]'
)
await searchInput.click()
await searchInput.type('test')
await searchInput.type('silly')
await newPage.waitForSelector('[data-testid=search-result]')
})
})