|
| 1 | +new Crawler({ |
| 2 | + appId: 'WQ5FYJCL00', |
| 3 | + apiKey: '1a3616197a9f4f4927b09aa9c629b54c', |
| 4 | + rateLimit: 8, |
| 5 | + startUrls: [ |
| 6 | + 'https://thegraph.com/docs/en/', |
| 7 | + 'https://thegraph.com/docs/ar/', |
| 8 | + 'https://thegraph.com/docs/es/', |
| 9 | + 'https://thegraph.com/docs/ja/', |
| 10 | + 'https://thegraph.com/docs/ko/', |
| 11 | + 'https://thegraph.com/docs/vi/', |
| 12 | + 'https://thegraph.com/docs/zh/', |
| 13 | + ], |
| 14 | + ignoreQueryParams: ['utm_medium', 'utm_source', 'utm_campaign', 'utm_term'], |
| 15 | + actions: [ |
| 16 | + { |
| 17 | + indexName: 'thegraph', |
| 18 | + pathsToMatch: ['https://thegraph.com/docs/**'], |
| 19 | + recordExtractor: ({ helpers }) => { |
| 20 | + return helpers.docsearch({ |
| 21 | + recordProps: { |
| 22 | + lvl0: { |
| 23 | + selectors: '.graph-docs-current-group', |
| 24 | + defaultValue: 'The Graph Docs', |
| 25 | + }, |
| 26 | + lvl1: '.graph-docs-content h1 > span:first-of-type', |
| 27 | + lvl2: '.graph-docs-content h2 > span:first-of-type', |
| 28 | + lvl3: '.graph-docs-content h3 > span:first-of-type', |
| 29 | + lvl4: '.graph-docs-content h4 > span:first-of-type', |
| 30 | + lvl5: '.graph-docs-content h5 > span:first-of-type', |
| 31 | + lvl6: '.graph-docs-content h6 > span:first-of-type', |
| 32 | + content: '.graph-docs-content p, .graph-docs-content li', |
| 33 | + }, |
| 34 | + }) |
| 35 | + }, |
| 36 | + }, |
| 37 | + ], |
| 38 | + initialIndexSettings: { |
| 39 | + thegraph: { |
| 40 | + attributesForFaceting: ['type', 'language'], |
| 41 | + attributesToRetrieve: ['hierarchy', 'content', 'anchor', 'url', 'url_without_anchor'], |
| 42 | + attributesToHighlight: ['hierarchy', 'hierarchy_camel', 'content'], |
| 43 | + attributesToSnippet: ['content:10'], |
| 44 | + camelCaseAttributes: ['hierarchy', 'hierarchy_radio', 'content'], |
| 45 | + searchableAttributes: [ |
| 46 | + 'unordered(hierarchy_radio_camel.lvl0)', |
| 47 | + 'unordered(hierarchy_radio.lvl0)', |
| 48 | + 'unordered(hierarchy_radio_camel.lvl1)', |
| 49 | + 'unordered(hierarchy_radio.lvl1)', |
| 50 | + 'unordered(hierarchy_radio_camel.lvl2)', |
| 51 | + 'unordered(hierarchy_radio.lvl2)', |
| 52 | + 'unordered(hierarchy_radio_camel.lvl3)', |
| 53 | + 'unordered(hierarchy_radio.lvl3)', |
| 54 | + 'unordered(hierarchy_radio_camel.lvl4)', |
| 55 | + 'unordered(hierarchy_radio.lvl4)', |
| 56 | + 'unordered(hierarchy_radio_camel.lvl5)', |
| 57 | + 'unordered(hierarchy_radio.lvl5)', |
| 58 | + 'unordered(hierarchy_radio_camel.lvl6)', |
| 59 | + 'unordered(hierarchy_radio.lvl6)', |
| 60 | + 'unordered(hierarchy_camel.lvl0)', |
| 61 | + 'unordered(hierarchy.lvl0)', |
| 62 | + 'unordered(hierarchy_camel.lvl1)', |
| 63 | + 'unordered(hierarchy.lvl1)', |
| 64 | + 'unordered(hierarchy_camel.lvl2)', |
| 65 | + 'unordered(hierarchy.lvl2)', |
| 66 | + 'unordered(hierarchy_camel.lvl3)', |
| 67 | + 'unordered(hierarchy.lvl3)', |
| 68 | + 'unordered(hierarchy_camel.lvl4)', |
| 69 | + 'unordered(hierarchy.lvl4)', |
| 70 | + 'unordered(hierarchy_camel.lvl5)', |
| 71 | + 'unordered(hierarchy.lvl5)', |
| 72 | + 'unordered(hierarchy_camel.lvl6)', |
| 73 | + 'unordered(hierarchy.lvl6)', |
| 74 | + 'content', |
| 75 | + ], |
| 76 | + distinct: true, |
| 77 | + attributeForDistinct: 'url', |
| 78 | + customRanking: ['desc(weight.pageRank)', 'desc(weight.level)', 'asc(weight.position)'], |
| 79 | + ranking: ['words', 'filters', 'typo', 'attribute', 'proximity', 'exact', 'custom'], |
| 80 | + highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">', |
| 81 | + highlightPostTag: '</span>', |
| 82 | + minWordSizefor1Typo: 3, |
| 83 | + minWordSizefor2Typos: 7, |
| 84 | + allowTyposOnNumericTokens: false, |
| 85 | + minProximity: 1, |
| 86 | + ignorePlurals: true, |
| 87 | + advancedSyntax: true, |
| 88 | + attributeCriteriaComputedByMinProximity: true, |
| 89 | + removeWordsIfNoResults: 'allOptional', |
| 90 | + }, |
| 91 | + }, |
| 92 | +}) |
0 commit comments