* feat(askai): add compatibility with algolia mcp search tool [DASH-2294] (#2862) ## Summary Fixes DASH-2294 Add compatibility with the Algolia MCP search tool (`algolia_search_index_${string}`) in AskAI. ## Changes - Add `AlgoliaMCPSearchTool` type to handle the Algolia MCP server search tool - Refactor how number of hits are retrieved in `ToolCall` into a `getNumberOfHits` helper ## Test plan - Added unit tests for modified code ✅ * chore: Update to use tsdown for build system (#2824) * chore: Update to use tsdown for build system * fix: docsearch-react build * fix: lint * fix: glob resolved to incorrect version * chore: migrate to from yarn, lerna and shipjs to bun & changesets (#2827) * chore: add tool-versions file for node and bun versions (#2866) * chore: watch in parallel (#2867) * feat: agent studio feedback integration (#2868) * feat(askai): Split Ask AI modal into own component (#2884) * feat(askai): Split Ask AI modal into own component * refactor(react): share modal utilities * refactor(react): share search box form * refactor(react): extract start screen sections * refactor(react): extract shared modal hooks * fix: lint adapter * refactor(react): reorganize modal files * fix: type error in examples * fix: remove ai modal from adapter for now, fix import paths of react package * feat(askai): Agent Studio core tools (#2886) * feat(askai): Implement dynamic tool calls * move ToolCall to components dir * Converge Agent Studio search tools to same definition, fix client side tools breaking UI state * add examples for custom tools * fix: lint & types * feat(askai): add Agent Studio memory support (#2888) * feat(askai): remove Ask AI transport layer (#2889) * feat(askai): add Agent Studio memory support * refactor(askai): remove Ask AI transport abstraction * feat(askai): Feedback notes and tags (#2890) * feat(askai): add Agent Studio memory support * refactor(askai): remove Ask AI transport abstraction * feat(askai): Feedback notes and tags * fix: bump css bundle size limit * move feedback actions to components * chore: fix deploys for v5 branch * feat(askai): Aggregate MCP search tool calls (#2891) * feat(askai): add Agent Studio memory support * refactor(askai): remove Ask AI transport abstraction * feat(askai): Feedback notes and tags * fix: bump css bundle size limit * move feedback actions to components * feat(askai): Aggregate MCP search tool calls * feat(askai): Allow dynamic indices for Agent Studio (#2893) * feat(v5): UI updates (#2896) * feat(v5): UI updates * fix: css file size * fix: e2e tests * fix: e2e tests * fix: e2e tests * chore: add theme toggle to react demo example * Update sources panel display, update dark theme * fix: lint * fix(askai): address ui review feedback * fix: pin icon positioning * fix(askai): improve a11y and dark-mode shimmer for thinking and error states - add role=alert/status and aria-hidden on error/thinking UI - support dark-mode shimmer gradients via CSS variables - respect prefers-reduced-motion for shimmer - handle null date in useRelativeFormattedDate with fallback translation * feat(v5): Add hit breadcrumbs (#2897) * feat(v5): UI updates * fix: css file size * fix: e2e tests * fix: e2e tests * fix: e2e tests * chore: add theme toggle to react demo example * Update sources panel display, update dark theme * fix: lint * fix(askai): address ui review feedback * fix: pin icon positioning * fix(askai): improve a11y and dark-mode shimmer for thinking and error states - add role=alert/status and aria-hidden on error/thinking UI - support dark-mode shimmer gradients via CSS variables - respect prefers-reduced-motion for shimmer - handle null date in useRelativeFormattedDate with fallback translation * feat(v5): Add hit breadcrumbs * fix: bump css bundle size limit * Fix after conflicts * chore: move CSS building to lightning css (#2898) * feat: Facet filters for search (#2899) * feat(v5): Initial facet filters work * Perf updates, dark theme, facet chips, a11y improvements * fix: bump css bundle size limit * Dedupe facet filters, refetch facets on searchParameters changes * Add chevron flourish * fix(askai): Fix new conversation causing thread depth errors (#2900) * feat(v5): Add hit result badge (#2901) * feat(v5): Add hit result badge * Add background to hit result badge * feat(v5): Add follow up prompt suggestions (#2902) * feat(v5): Add follow up prompt suggestions * fix: bump css bundle size limit * docs(agents): document Cursor Cloud dev environment setup for v5 (Bun) (#2903) Co-authored-by: Cursor Agent <cursoragent@cursor.com> * feat(mcp): setup mcp plugins (#2895) * feat(v5): Add prompt suggestions to keyword search (#2912) * feat(v5): Add prompt suggestions to keyword search * cleanup: Move consistent object to reusable constant * chore(v5): Split Ask AI related CSS into own bundle (#2913) * chore(v5): Split Ask AI related CSS into own bundle * move style.css to include modal and askai * fix: Ensure stage level and watch level scripts use bun runtime (#2915) * fix: Ensure stage level and watch level scripts use bun runtime * chore: move to node@24 update imports * fix: lint * feat(js): Document JS based hybrid mode, fix JS packages (#2916) * feat(js): Document JS based hybrid mode, fix JS packages * update: add model onOpen to docs * feat(cli): add @docsearch/cli for MCP setup and search (#2911) * chore(tsdown): Bump to latest tsdown version (#2918) * chore(tsdown): Bump to latest tsdown version * fix: bump nvmrc node version * fix: cli tsconfig * fix: website build * fix: example build * fix: circleci install bun * fix: lint * fix: circleci install bun * fix: circleci install bun * fix: circleci install bun * refactor(docusaurus-adapter): rework theme config for v5 and modularize SearchPage (#2904) Co-authored-by: Paul Jankowski <8BitTitan@gmail.com> * feat(askai): Move askai related props under root askai (#2919) * feat(askai): Move askai related props under root askai * fix: playwright test case * fix(docusaurus): validate Ask AI options * feat(js): Split JS bundles for search only (#2920) * chore: Move to oxlint and oxfmt (#2923) * chore: Get NPM OIDC token before publishing (#2924) * chore: Enter v5 beta (#2925) * chore: Enter pre release mode for v5 * chore: update release summary * chore: version bump * fix: Remove NPM_ID_TOKEN for release * fix: Try setting blank NPM_TOKEN * fix: Try blank NPM_AUTH_TOKEN * chore: bump node and npm for release job * docs(mcp): add service disclaimer (#2921) * fix: Agent Studio MCP search tool (#2927) * fix: Agent Studio MCP search tool * Add changeset * chore: Update stylelint (#2926) * chore: stylelint update * bun.lock * Add changeset * fix(website): use bare @import for tailwindcss (#2933) Tailwind's build-time `@import` cannot be written with `url()` notation, so `@import url('tailwindcss')` was passed through as a plain CSS import instead of being processed by Tailwind. Also syncs bun.lock with the 5.0.0-beta.0 versions already committed to package.json. * chore: version v5.0.0-beta.1 (#2932) * feat(react): remove deprecated index props (#2936) * feat(mcp): add ChatGPT and Codex DocSearch plugin package (#2938) * fix: cleanup claude * feat: website redesign (#2930) Co-authored-by: Cursor <cursoragent@cursor.com> * fix: lint * fix: crash on the demo (#2940) * feat(docs): Document v5 beta (#2935) * chore(docs): v5 documentation * Writing style clean up * fix: website after conflicts * fix: reported issues on mobile (#2944) * chore: Introduce a11y smoke tests (#2943) * chore: Add Lorris as codeowner (#2946) * fix(askai): Ask AI fixes for v5 (#2945) * fix: General v5 fixes (#2947) - Fix `ref` console error for a `FacetMenu` - Whitespace only search/conversation input does not trigger requests - Fix flash of no results page on search * feat: v5 general improvements (#2948) * feat(v5): General fixes and improvements * add changeset * fix: bundlesize * feat(v5): UI and DX improvements (#2949) * feat: Rename assistantId to agentId * feat: Allow reading default facet values from index searchParameters * feat: Remove indexName prop from Sidepanel, cleanup documentation pages * feat: Move appId and apiKey up into @docsearch/core * feat: Add back nested grouping of search results * add changeset * revert changes to example demo * fix: e2e tests * chore: push git tags on version release (#2951) * chore: release v5.0.0-beta.2 (#2950) * chore: Fix pushing git tags (#2953) * fix(askai): sanitize markdown HTML in v5 (#2954) Backport of #2929.\n\nOriginal commit:681cbfec03Co-authored-by: Vasco Bettencourt <32492444+vascobettencourt@users.noreply.github.com> * fix(v5): stop truncating mobile snippets (#2958) * fix(v5): stop truncating mobile snippets Backport of #2907.\n\nOriginal commit:9ad6d169fe* fix(v5): allow mobile hit text to wrap Completes the v5 adaptation of #2907 by overriding later v5 child-level truncation rules.\n\nOriginal commit:9ad6d169fe* chore(v5): account for mobile wrapping CSS Updates the CSS size budget for the v5 adaptation of #2907.\n\nOriginal commit:9ad6d169fe--------- Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> * feat(v5): Add new footerAction prop (#2952) * feat(v5): Add new footerAction prop * Resolve PR comments * fix(v5): recognize conversation depth errors (#2957) Backport of #2881.\n\nOriginal commit:f68e52251cCo-authored-by: Felipe Bermudez <felipeberm@gmail.com> * fix(v5): expose Sidepanel search parameter types (#2956) * fix(v5): expose Sidepanel search parameter types Backport of #2906.\n\nOriginal commit:4710d0ca77* Delete sidepanel.test.ts Had a pointless test case in it. --------- Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> * fix(v5): ignore slash shortcut on focused buttons (#2955) Backport of #2871.\n\nOriginal commit:0e41a78c44Co-authored-by: Sigmabro <122412346+Sigmabrogz@users.noreply.github.com> * fix(agentStudio): agents dynamic mode enabled (#2959) * fix(agentStudio): agents dynamic mode enabled * fix(askai): use string[] for dynamic agentStudio indices * feat(docs): add Ask AI to Agent Studio migration guide (#2931) * feat(docs): add Ask AI to Agent Studio migration guide * feat(docs): agentStudio migrating from askAI * feat(docs): renaming agentId * feat(agentStudio): dynamic mode indices updated * fix: Docusaurus adapter styling, DocSearch website fixes (#2960) * chore: release v5.0.0-beta.3 (#2961) * feat(website): Launch updates (#2964) * fix(website): Fix font loading (#2966) * feat(v5): Back port cost control errors (#2965) * chore: release v5.0.0-beta.4 (#2967) --------- Co-authored-by: Vincent Lemeunier <vincentlemeunier+git@gmail.com> Co-authored-by: Dylan Tientcheu <dylan.tientcheu@algolia.com> Co-authored-by: Lorris Saint-Genez <lorrissaintgenez@gmail.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Dylan Tientcheu <dylantientcheu@gmail.com> Co-authored-by: Vasco Bettencourt <32492444+vascobettencourt@users.noreply.github.com> Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Co-authored-by: Felipe Bermudez <felipeberm@gmail.com> Co-authored-by: Sigmabro <122412346+Sigmabrogz@users.noreply.github.com>
1069 lines
30 KiB
Text
1069 lines
30 KiB
Text
---
|
|
title: Config Templates
|
|
---
|
|
|
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
|
|
To help you create the best search experience for your users, we provide out-of-the-box crawler config templates for multiple websites generators. If you'd like to add a new template to our list, or believe we should update an existing one, please [let us know on Discord][1] or [open a pull request][2].
|
|
|
|
> If you want to better understand the default parameters of the configs below, take a look at the [Crawler documentation](https://www.algolia.com/doc/tools/crawler/apis/configuration/).
|
|
|
|
## Getting Started
|
|
|
|
Once approved for DocSearch, we will automatically create a Crawler on your behalf, include your URL, and the Algolia credentials for your appId, apiKey, and indexName. If we detect that you are using any of the predefined generators, we'll attempt to automatically assign the proper template that matches your generator. However, this is not guaranteed. If no specific generator is detected, we will apply the default template seen below.
|
|
|
|
## Updating the Template
|
|
|
|
You can manually update the crawler template by going to dashboard.algolia.com, click "Data sources", select your crawler, and go to the editor page. From there you can edit the JavaScript directly. Note that you can make draft changes without saving, test the changes using the "URL Tester", and then "Save" once you're happy with your changes.
|
|
|
|
## Default Template
|
|
|
|
<details>
|
|
<summary>default.js</summary>
|
|
<div>
|
|
|
|
```js
|
|
new Crawler({
|
|
appId: 'YOUR_APP_ID',
|
|
apiKey: 'YOUR_API_KEY',
|
|
indexPrefix: 'crawler_',
|
|
rateLimit: 8,
|
|
maxDepth: 10,
|
|
startUrls: ['https://YOUR_WEBSITE_URL'],
|
|
renderJavaScript: false,
|
|
sitemaps: [],
|
|
ignoreCanonicalTo: false,
|
|
discoveryPatterns: ['https://YOUR_WEBSITE_URL/**'],
|
|
actions: [
|
|
{
|
|
indexName: 'YOUR_INDEX_NAME',
|
|
pathsToMatch: ['https://YOUR_WEBSITE_URL/**'],
|
|
recordExtractor: ({ helpers }) => {
|
|
return helpers.docsearch({
|
|
recordProps: {
|
|
lvl1: ['header h1', 'article h1', 'main h1', 'h1', 'head > title'],
|
|
content: ['article p, article li', 'main p, main li', 'p, li'],
|
|
lvl0: {
|
|
selectors: '',
|
|
defaultValue: 'Documentation',
|
|
},
|
|
lvl2: ['article h2', 'main h2', 'h2'],
|
|
lvl3: ['article h3', 'main h3', 'h3'],
|
|
lvl4: ['article h4', 'main h4', 'h4'],
|
|
lvl5: ['article h5', 'main h5', 'h5'],
|
|
lvl6: ['article h6', 'main h6', 'h6'],
|
|
},
|
|
aggregateContent: true,
|
|
recordVersion: 'v3',
|
|
});
|
|
},
|
|
},
|
|
],
|
|
initialIndexSettings: {
|
|
YOUR_INDEX_NAME: {
|
|
attributesForFaceting: ['type', 'lang'],
|
|
attributesToRetrieve: [
|
|
'hierarchy',
|
|
'content',
|
|
'anchor',
|
|
'url',
|
|
'url_without_anchor',
|
|
'type',
|
|
],
|
|
attributesToHighlight: ['hierarchy', 'content'],
|
|
attributesToSnippet: ['content:10'],
|
|
camelCaseAttributes: ['hierarchy', 'content'],
|
|
searchableAttributes: [
|
|
'unordered(hierarchy.lvl0)',
|
|
'unordered(hierarchy.lvl1)',
|
|
'unordered(hierarchy.lvl2)',
|
|
'unordered(hierarchy.lvl3)',
|
|
'unordered(hierarchy.lvl4)',
|
|
'unordered(hierarchy.lvl5)',
|
|
'unordered(hierarchy.lvl6)',
|
|
'content',
|
|
],
|
|
distinct: true,
|
|
attributeForDistinct: 'url',
|
|
customRanking: [
|
|
'desc(weight.pageRank)',
|
|
'desc(weight.level)',
|
|
'asc(weight.position)',
|
|
],
|
|
ranking: [
|
|
'words',
|
|
'filters',
|
|
'typo',
|
|
'attribute',
|
|
'proximity',
|
|
'exact',
|
|
'custom',
|
|
],
|
|
highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
|
|
highlightPostTag: '</span>',
|
|
minWordSizefor1Typo: 3,
|
|
minWordSizefor2Typos: 7,
|
|
allowTyposOnNumericTokens: false,
|
|
minProximity: 1,
|
|
ignorePlurals: true,
|
|
advancedSyntax: true,
|
|
attributeCriteriaComputedByMinProximity: true,
|
|
removeWordsIfNoResults: 'allOptional',
|
|
},
|
|
},
|
|
});
|
|
```
|
|
|
|
</div>
|
|
</details>
|
|
|
|
## Docusaurus v1 Template
|
|
|
|
<details>
|
|
<summary>docusaurus-v1.js</summary>
|
|
<div>
|
|
|
|
```js
|
|
new Crawler({
|
|
appId: 'YOUR_APP_ID',
|
|
apiKey: 'YOUR_API_KEY',
|
|
rateLimit: 8,
|
|
maxDepth: 10,
|
|
startUrls: [
|
|
'https://YOUR_WEBSITE_URL/docs/',
|
|
'https://YOUR_WEBSITE_URL/',
|
|
'https://YOUR_WEBSITE_URL/blog/',
|
|
],
|
|
sitemaps: ['https://YOUR_WEBSITE_URL/sitemap.xml'],
|
|
ignoreCanonicalTo: false,
|
|
discoveryPatterns: ['https://YOUR_WEBSITE_URL/**'],
|
|
actions: [
|
|
{
|
|
indexName: 'YOUR_INDEX_NAME',
|
|
pathsToMatch: ['https://YOUR_WEBSITE_URL/docs/**'],
|
|
recordExtractor: ({ $, helpers }) => {
|
|
// Removing DOM elements we don't want to crawl
|
|
const toRemove = '.hash-link';
|
|
$(toRemove).remove();
|
|
|
|
return helpers.docsearch({
|
|
recordProps: {
|
|
lvl0: {
|
|
selectors: '.navBreadcrumb h2 span',
|
|
defaultValue: 'Docs',
|
|
},
|
|
lvl1: '.post h1',
|
|
lvl2: '.post h2',
|
|
lvl3: '.post h3',
|
|
lvl4: '.post h4',
|
|
content: '.post article p, .post article li',
|
|
tags: {
|
|
defaultValue: ['docs'],
|
|
},
|
|
},
|
|
indexHeadings: true,
|
|
aggregateContent: true,
|
|
});
|
|
},
|
|
},
|
|
{
|
|
indexName: 'YOUR_INDEX_NAME',
|
|
pathsToMatch: ['https://YOUR_WEBSITE_URL/blog/**'],
|
|
recordExtractor: ({ $, helpers }) => {
|
|
// Removing DOM elements we don't want to crawl
|
|
const toRemove = '.hash-link';
|
|
$(toRemove).remove();
|
|
|
|
return helpers.docsearch({
|
|
recordProps: {
|
|
lvl0: {
|
|
selectors: '.navBreadcrumb h2 span',
|
|
defaultValue: 'Blog',
|
|
},
|
|
lvl1: '.post h1',
|
|
lvl2: '.post h2',
|
|
lvl3: '.post h3',
|
|
lvl4: '.post h4',
|
|
content: '.post article p, .post article li',
|
|
tags: {
|
|
defaultValue: ['blog'],
|
|
},
|
|
},
|
|
indexHeadings: true,
|
|
aggregateContent: true,
|
|
});
|
|
},
|
|
},
|
|
],
|
|
initialIndexSettings: {
|
|
YOUR_INDEX_NAME: {
|
|
attributesForFaceting: ['type', 'lang', 'language', 'version', 'tags'],
|
|
attributesToRetrieve: [
|
|
'hierarchy',
|
|
'content',
|
|
'anchor',
|
|
'url',
|
|
'url_without_anchor',
|
|
'type',
|
|
],
|
|
attributesToHighlight: ['hierarchy', 'hierarchy_camel', 'content'],
|
|
attributesToSnippet: ['content:10'],
|
|
camelCaseAttributes: ['hierarchy', 'hierarchy_radio', 'content'],
|
|
searchableAttributes: [
|
|
'unordered(hierarchy_radio_camel.lvl0)',
|
|
'unordered(hierarchy_radio.lvl0)',
|
|
'unordered(hierarchy_radio_camel.lvl1)',
|
|
'unordered(hierarchy_radio.lvl1)',
|
|
'unordered(hierarchy_radio_camel.lvl2)',
|
|
'unordered(hierarchy_radio.lvl2)',
|
|
'unordered(hierarchy_radio_camel.lvl3)',
|
|
'unordered(hierarchy_radio.lvl3)',
|
|
'unordered(hierarchy_radio_camel.lvl4)',
|
|
'unordered(hierarchy_radio.lvl4)',
|
|
'unordered(hierarchy_radio_camel.lvl5)',
|
|
'unordered(hierarchy_radio.lvl5)',
|
|
'unordered(hierarchy_radio_camel.lvl6)',
|
|
'unordered(hierarchy_radio.lvl6)',
|
|
'unordered(hierarchy_camel.lvl0)',
|
|
'unordered(hierarchy.lvl0)',
|
|
'unordered(hierarchy_camel.lvl1)',
|
|
'unordered(hierarchy.lvl1)',
|
|
'unordered(hierarchy_camel.lvl2)',
|
|
'unordered(hierarchy.lvl2)',
|
|
'unordered(hierarchy_camel.lvl3)',
|
|
'unordered(hierarchy.lvl3)',
|
|
'unordered(hierarchy_camel.lvl4)',
|
|
'unordered(hierarchy.lvl4)',
|
|
'unordered(hierarchy_camel.lvl5)',
|
|
'unordered(hierarchy.lvl5)',
|
|
'unordered(hierarchy_camel.lvl6)',
|
|
'unordered(hierarchy.lvl6)',
|
|
'content',
|
|
],
|
|
distinct: true,
|
|
attributeForDistinct: 'url',
|
|
customRanking: [
|
|
'desc(weight.pageRank)',
|
|
'desc(weight.level)',
|
|
'asc(weight.position)',
|
|
],
|
|
ranking: [
|
|
'words',
|
|
'filters',
|
|
'typo',
|
|
'attribute',
|
|
'proximity',
|
|
'exact',
|
|
'custom',
|
|
],
|
|
highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
|
|
highlightPostTag: '</span>',
|
|
minWordSizefor1Typo: 3,
|
|
minWordSizefor2Typos: 7,
|
|
allowTyposOnNumericTokens: false,
|
|
minProximity: 1,
|
|
ignorePlurals: true,
|
|
advancedSyntax: true,
|
|
attributeCriteriaComputedByMinProximity: true,
|
|
removeWordsIfNoResults: 'allOptional',
|
|
},
|
|
},
|
|
});
|
|
```
|
|
|
|
</div>
|
|
</details>
|
|
|
|
## Docusaurus v2 & v3 Template
|
|
|
|
<details>
|
|
<summary>docusaurus-v2.js</summary>
|
|
<div>
|
|
|
|
```js
|
|
new Crawler({
|
|
appId: 'YOUR_APP_ID',
|
|
apiKey: 'YOUR_API_KEY',
|
|
rateLimit: 8,
|
|
maxDepth: 10,
|
|
startUrls: ['https://YOUR_WEBSITE_URL/'],
|
|
sitemaps: ['https://YOUR_WEBSITE_URL/sitemap.xml'],
|
|
ignoreCanonicalTo: true,
|
|
discoveryPatterns: ['https://YOUR_WEBSITE_URL/**'],
|
|
actions: [
|
|
{
|
|
indexName: 'YOUR_INDEX_NAME',
|
|
pathsToMatch: ['https://YOUR_WEBSITE_URL/**'],
|
|
recordExtractor: ({ $, helpers }) => {
|
|
// priority order: deepest active sub list header -> navbar active item -> 'Documentation'
|
|
// Extracting the breadcrumb titles for better accessibility.
|
|
const navbarTitle = $(".navbar__item.navbar__link--active").text();
|
|
const pageBreadcrumbTitles = $(".breadcrumbs__link")
|
|
.toArray()
|
|
.map((item) => $(item).text().trim())
|
|
.filter(Boolean);
|
|
const lvl0 =
|
|
[navbarTitle, ...pageBreadcrumbTitles].join(" / ") || "Documentation";
|
|
|
|
return helpers.docsearch({
|
|
recordProps: {
|
|
lvl0: {
|
|
selectors: '',
|
|
defaultValue: lvl0,
|
|
},
|
|
lvl1: ['header h1', 'article h1'],
|
|
lvl2: 'article h2',
|
|
lvl3: 'article h3',
|
|
lvl4: 'article h4',
|
|
lvl5: 'article h5, article td:first-child',
|
|
lvl6: 'article h6',
|
|
content: 'article p, article li, article td:last-child',
|
|
},
|
|
indexHeadings: true,
|
|
aggregateContent: true,
|
|
recordVersion: 'v3',
|
|
});
|
|
},
|
|
},
|
|
],
|
|
initialIndexSettings: {
|
|
YOUR_INDEX_NAME: {
|
|
attributesForFaceting: [
|
|
'type',
|
|
'lang',
|
|
'language',
|
|
'version',
|
|
'docusaurus_tag',
|
|
],
|
|
attributesToRetrieve: [
|
|
'hierarchy',
|
|
'content',
|
|
'anchor',
|
|
'url',
|
|
'url_without_anchor',
|
|
'type',
|
|
],
|
|
attributesToHighlight: ['hierarchy', 'content'],
|
|
attributesToSnippet: ['content:10'],
|
|
camelCaseAttributes: ['hierarchy', 'content'],
|
|
searchableAttributes: [
|
|
'unordered(hierarchy.lvl0)',
|
|
'unordered(hierarchy.lvl1)',
|
|
'unordered(hierarchy.lvl2)',
|
|
'unordered(hierarchy.lvl3)',
|
|
'unordered(hierarchy.lvl4)',
|
|
'unordered(hierarchy.lvl5)',
|
|
'unordered(hierarchy.lvl6)',
|
|
'content',
|
|
],
|
|
distinct: true,
|
|
attributeForDistinct: 'url',
|
|
customRanking: [
|
|
'desc(weight.pageRank)',
|
|
'desc(weight.level)',
|
|
'asc(weight.position)',
|
|
],
|
|
ranking: [
|
|
'words',
|
|
'filters',
|
|
'typo',
|
|
'attribute',
|
|
'proximity',
|
|
'exact',
|
|
'custom',
|
|
],
|
|
highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
|
|
highlightPostTag: '</span>',
|
|
minWordSizefor1Typo: 3,
|
|
minWordSizefor2Typos: 7,
|
|
allowTyposOnNumericTokens: false,
|
|
minProximity: 1,
|
|
ignorePlurals: true,
|
|
advancedSyntax: true,
|
|
attributeCriteriaComputedByMinProximity: true,
|
|
removeWordsIfNoResults: 'allOptional',
|
|
separatorsToIndex: '_',
|
|
},
|
|
},
|
|
});
|
|
```
|
|
|
|
</div>
|
|
</details>
|
|
|
|
## Astro Starlight Template
|
|
|
|
<details>
|
|
<summary>starlight.js</summary>
|
|
<div>
|
|
|
|
```js
|
|
new Crawler({
|
|
appId: 'YOUR_APP_ID',
|
|
apiKey: 'YOUR_API_KEY',
|
|
rateLimit: 8,
|
|
maxDepth: 10,
|
|
startUrls: ['https://YOUR_WEBSITE_URL/'],
|
|
sitemaps: ['https://YOUR_WEBSITE_URL/sitemap-index.xml'],
|
|
ignoreCanonicalTo: true,
|
|
discoveryPatterns: ['https://YOUR_WEBSITE_URL/**'],
|
|
actions: [
|
|
{
|
|
indexName: 'YOUR_INDEX_NAME',
|
|
pathsToMatch: ['https://YOUR_WEBSITE_URL/**'],
|
|
recordExtractor: ({ $, helpers }) => {
|
|
// Get the top level menu item
|
|
const lvl0 =
|
|
$('details:has(a[aria-current="page"])')
|
|
.find("summary")
|
|
.find("span")
|
|
.text() || "Documentation";
|
|
|
|
return helpers.docsearch({
|
|
recordProps: {
|
|
lvl0: {
|
|
selectors: "",
|
|
defaultValue: lvl0,
|
|
},
|
|
lvl1: "main h1",
|
|
lvl2: "main h2",
|
|
lvl3: "main h3",
|
|
lvl4: "main h4",
|
|
lvl5: "main h5",
|
|
lvl6: "main h6",
|
|
content: "main p, main li",
|
|
},
|
|
indexHeadings: true,
|
|
aggregateContent: true,
|
|
});
|
|
},
|
|
},
|
|
],
|
|
initialIndexSettings: {
|
|
YOUR_INDEX_NAME: {
|
|
attributesForFaceting: [
|
|
'type',
|
|
'lang',
|
|
],
|
|
attributesToRetrieve: [
|
|
'hierarchy',
|
|
'content',
|
|
'anchor',
|
|
'url',
|
|
],
|
|
attributesToHighlight: ['hierarchy', 'content'],
|
|
attributesToSnippet: ['content:10'],
|
|
camelCaseAttributes: ['hierarchy', 'content'],
|
|
searchableAttributes: [
|
|
'unordered(hierarchy.lvl0)',
|
|
'unordered(hierarchy.lvl1)',
|
|
'unordered(hierarchy.lvl2)',
|
|
'unordered(hierarchy.lvl3)',
|
|
'unordered(hierarchy.lvl4)',
|
|
'unordered(hierarchy.lvl5)',
|
|
'unordered(hierarchy.lvl6)',
|
|
'content',
|
|
],
|
|
distinct: true,
|
|
attributeForDistinct: 'url',
|
|
customRanking: [
|
|
'desc(weight.pageRank)',
|
|
'desc(weight.level)',
|
|
'asc(weight.position)',
|
|
],
|
|
ranking: [
|
|
'words',
|
|
'filters',
|
|
'typo',
|
|
'attribute',
|
|
'proximity',
|
|
'exact',
|
|
'custom',
|
|
],
|
|
highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
|
|
highlightPostTag: '</span>',
|
|
minWordSizefor1Typo: 3,
|
|
minWordSizefor2Typos: 7,
|
|
allowTyposOnNumericTokens: false,
|
|
minProximity: 1,
|
|
ignorePlurals: true,
|
|
advancedSyntax: true,
|
|
attributeCriteriaComputedByMinProximity: true,
|
|
removeWordsIfNoResults: 'allOptional',
|
|
},
|
|
},
|
|
});
|
|
```
|
|
|
|
</div>
|
|
</details>
|
|
|
|
## Vuepress v1 Template
|
|
|
|
<details>
|
|
<summary>vuepress-v1.js</summary>
|
|
<div>
|
|
|
|
```js
|
|
new Crawler({
|
|
appId: 'YOUR_APP_ID',
|
|
apiKey: 'YOUR_API_KEY',
|
|
rateLimit: 8,
|
|
maxDepth: 10,
|
|
startUrls: ['https://YOUR_WEBSITE_URL/'],
|
|
sitemaps: ['https://YOUR_WEBSITE_URL/sitemap.xml'],
|
|
ignoreCanonicalTo: false,
|
|
discoveryPatterns: ['https://YOUR_WEBSITE_URL/**'],
|
|
actions: [
|
|
{
|
|
indexName: 'YOUR_INDEX_NAME',
|
|
pathsToMatch: ['https://YOUR_WEBSITE_URL/**'],
|
|
recordExtractor: ({ $, helpers }) => {
|
|
return helpers.docsearch({
|
|
recordProps: {
|
|
lvl0: {
|
|
selectors: 'p.sidebar-heading.open',
|
|
defaultValue: 'Documentation',
|
|
},
|
|
lvl1: '.content__default h1',
|
|
lvl2: '.content__default h2',
|
|
lvl3: '.content__default h3',
|
|
lvl4: '.content__default h4',
|
|
lvl5: '.content__default h5',
|
|
content: '.content__default p, .content__default li',
|
|
},
|
|
indexHeadings: true,
|
|
aggregateContent: true,
|
|
});
|
|
},
|
|
},
|
|
],
|
|
initialIndexSettings: {
|
|
YOUR_INDEX_NAME: {
|
|
attributesForFaceting: ['type', 'lang'],
|
|
attributesToRetrieve: ['hierarchy', 'content', 'anchor', 'url'],
|
|
attributesToHighlight: ['hierarchy', 'hierarchy_camel', 'content'],
|
|
attributesToSnippet: ['content:10'],
|
|
camelCaseAttributes: ['hierarchy', 'hierarchy_radio', 'content'],
|
|
searchableAttributes: [
|
|
'unordered(hierarchy_radio_camel.lvl0)',
|
|
'unordered(hierarchy_radio.lvl0)',
|
|
'unordered(hierarchy_radio_camel.lvl1)',
|
|
'unordered(hierarchy_radio.lvl1)',
|
|
'unordered(hierarchy_radio_camel.lvl2)',
|
|
'unordered(hierarchy_radio.lvl2)',
|
|
'unordered(hierarchy_radio_camel.lvl3)',
|
|
'unordered(hierarchy_radio.lvl3)',
|
|
'unordered(hierarchy_radio_camel.lvl4)',
|
|
'unordered(hierarchy_radio.lvl4)',
|
|
'unordered(hierarchy_radio_camel.lvl5)',
|
|
'unordered(hierarchy_radio.lvl5)',
|
|
'unordered(hierarchy_radio_camel.lvl6)',
|
|
'unordered(hierarchy_radio.lvl6)',
|
|
'unordered(hierarchy_camel.lvl0)',
|
|
'unordered(hierarchy.lvl0)',
|
|
'unordered(hierarchy_camel.lvl1)',
|
|
'unordered(hierarchy.lvl1)',
|
|
'unordered(hierarchy_camel.lvl2)',
|
|
'unordered(hierarchy.lvl2)',
|
|
'unordered(hierarchy_camel.lvl3)',
|
|
'unordered(hierarchy.lvl3)',
|
|
'unordered(hierarchy_camel.lvl4)',
|
|
'unordered(hierarchy.lvl4)',
|
|
'unordered(hierarchy_camel.lvl5)',
|
|
'unordered(hierarchy.lvl5)',
|
|
'unordered(hierarchy_camel.lvl6)',
|
|
'unordered(hierarchy.lvl6)',
|
|
'content',
|
|
],
|
|
distinct: true,
|
|
attributeForDistinct: 'url',
|
|
customRanking: [
|
|
'desc(weight.pageRank)',
|
|
'desc(weight.level)',
|
|
'asc(weight.position)',
|
|
],
|
|
ranking: [
|
|
'words',
|
|
'filters',
|
|
'typo',
|
|
'attribute',
|
|
'proximity',
|
|
'exact',
|
|
'custom',
|
|
],
|
|
highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
|
|
highlightPostTag: '</span>',
|
|
minWordSizefor1Typo: 3,
|
|
minWordSizefor2Typos: 7,
|
|
allowTyposOnNumericTokens: false,
|
|
minProximity: 1,
|
|
ignorePlurals: true,
|
|
advancedSyntax: true,
|
|
attributeCriteriaComputedByMinProximity: true,
|
|
removeWordsIfNoResults: 'allOptional',
|
|
},
|
|
},
|
|
});
|
|
```
|
|
|
|
</div>
|
|
</details>
|
|
|
|
## Vuepress v2 Template
|
|
|
|
<details>
|
|
<summary>vuepress-v2.js</summary>
|
|
<div>
|
|
|
|
```js
|
|
new Crawler({
|
|
appId: 'YOUR_APP_ID',
|
|
apiKey: 'YOUR_API_KEY',
|
|
rateLimit: 8,
|
|
maxDepth: 10,
|
|
startUrls: ['https://YOUR_WEBSITE_URL/'],
|
|
sitemaps: ['https://YOUR_WEBSITE_URL/sitemap.xml'],
|
|
ignoreCanonicalTo: false,
|
|
discoveryPatterns: ['https://YOUR_WEBSITE_URL/**'],
|
|
actions: [
|
|
{
|
|
indexName: 'YOUR_INDEX_NAME',
|
|
pathsToMatch: ['https://YOUR_WEBSITE_URL/**'],
|
|
recordExtractor: ({ $, helpers }) => {
|
|
return helpers.docsearch({
|
|
recordProps: {
|
|
lvl0: {
|
|
selectors: '.sidebar-heading.active',
|
|
defaultValue: 'Documentation',
|
|
},
|
|
lvl1: '.theme-default-content h1',
|
|
lvl2: '.theme-default-content h2',
|
|
lvl3: '.theme-default-content h3',
|
|
lvl4: '.theme-default-content h4',
|
|
lvl5: '.theme-default-content h5',
|
|
content: '.theme-default-content p, .theme-default-content li',
|
|
},
|
|
indexHeadings: true,
|
|
aggregateContent: true,
|
|
recordVersion: 'v3',
|
|
});
|
|
},
|
|
},
|
|
],
|
|
initialIndexSettings: {
|
|
YOUR_INDEX_NAME: {
|
|
attributesForFaceting: ['type', 'lang'],
|
|
attributesToRetrieve: ['hierarchy', 'content', 'anchor', 'url'],
|
|
attributesToHighlight: ['hierarchy', 'content'],
|
|
attributesToSnippet: ['content:10'],
|
|
camelCaseAttributes: ['hierarchy', 'content'],
|
|
searchableAttributes: [
|
|
'unordered(hierarchy.lvl0)',
|
|
'unordered(hierarchy.lvl1)',
|
|
'unordered(hierarchy.lvl2)',
|
|
'unordered(hierarchy.lvl3)',
|
|
'unordered(hierarchy.lvl4)',
|
|
'unordered(hierarchy.lvl5)',
|
|
'unordered(hierarchy.lvl6)',
|
|
'content',
|
|
],
|
|
distinct: true,
|
|
attributeForDistinct: 'url',
|
|
customRanking: [
|
|
'desc(weight.pageRank)',
|
|
'desc(weight.level)',
|
|
'asc(weight.position)',
|
|
],
|
|
ranking: [
|
|
'words',
|
|
'filters',
|
|
'typo',
|
|
'attribute',
|
|
'proximity',
|
|
'exact',
|
|
'custom',
|
|
],
|
|
highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
|
|
highlightPostTag: '</span>',
|
|
minWordSizefor1Typo: 3,
|
|
minWordSizefor2Typos: 7,
|
|
allowTyposOnNumericTokens: false,
|
|
minProximity: 1,
|
|
ignorePlurals: true,
|
|
advancedSyntax: true,
|
|
attributeCriteriaComputedByMinProximity: true,
|
|
removeWordsIfNoResults: 'allOptional',
|
|
},
|
|
},
|
|
});
|
|
```
|
|
|
|
</div>
|
|
</details>
|
|
|
|
## Vitepress Template
|
|
|
|
<details>
|
|
<summary>vitepress.js</summary>
|
|
<div>
|
|
|
|
```js
|
|
new Crawler({
|
|
appId: 'YOUR_APP_ID',
|
|
apiKey: 'YOUR_API_KEY',
|
|
rateLimit: 8,
|
|
maxDepth: 10,
|
|
startUrls: ['https://YOUR_WEBSITE_URL/'],
|
|
sitemaps: ['https://YOUR_WEBSITE_URL/sitemap.xml'],
|
|
discoveryPatterns: ['https://YOUR_WEBSITE_URL/**'],
|
|
actions: [
|
|
{
|
|
indexName: 'YOUR_INDEX_NAME',
|
|
pathsToMatch: ['https://YOUR_WEBSITE_URL/**'],
|
|
recordExtractor: ({ $, helpers }) => {
|
|
return helpers.docsearch({
|
|
recordProps: {
|
|
lvl0: {
|
|
selectors: '',
|
|
defaultValue: 'Documentation',
|
|
},
|
|
lvl1: '.content h1',
|
|
lvl2: '.content h2',
|
|
lvl3: '.content h3',
|
|
lvl4: '.content h4',
|
|
lvl5: '.content h5',
|
|
content: '.content p, .content li',
|
|
},
|
|
indexHeadings: true,
|
|
aggregateContent: true,
|
|
recordVersion: 'v3',
|
|
});
|
|
},
|
|
},
|
|
],
|
|
initialIndexSettings: {
|
|
YOUR_INDEX_NAME: {
|
|
attributesForFaceting: ['type', 'lang'],
|
|
attributesToRetrieve: ['hierarchy', 'content', 'anchor', 'url'],
|
|
attributesToHighlight: ['hierarchy', 'content'],
|
|
attributesToSnippet: ['content:10'],
|
|
camelCaseAttributes: ['hierarchy', 'content'],
|
|
searchableAttributes: [
|
|
'unordered(hierarchy.lvl0)',
|
|
'unordered(hierarchy.lvl1)',
|
|
'unordered(hierarchy.lvl2)',
|
|
'unordered(hierarchy.lvl3)',
|
|
'unordered(hierarchy.lvl4)',
|
|
'unordered(hierarchy.lvl5)',
|
|
'unordered(hierarchy.lvl6)',
|
|
'content',
|
|
],
|
|
distinct: true,
|
|
attributeForDistinct: 'url',
|
|
customRanking: [
|
|
'desc(weight.pageRank)',
|
|
'desc(weight.level)',
|
|
'asc(weight.position)',
|
|
],
|
|
ranking: [
|
|
'words',
|
|
'filters',
|
|
'typo',
|
|
'attribute',
|
|
'proximity',
|
|
'exact',
|
|
'custom',
|
|
],
|
|
highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
|
|
highlightPostTag: '</span>',
|
|
minWordSizefor1Typo: 3,
|
|
minWordSizefor2Typos: 7,
|
|
allowTyposOnNumericTokens: false,
|
|
minProximity: 1,
|
|
ignorePlurals: true,
|
|
advancedSyntax: true,
|
|
attributeCriteriaComputedByMinProximity: true,
|
|
removeWordsIfNoResults: 'allOptional',
|
|
},
|
|
},
|
|
});
|
|
```
|
|
|
|
</div>
|
|
</details>
|
|
|
|
## Rspress Template
|
|
|
|
<details>
|
|
<summary>rspress.js</summary>
|
|
<div>
|
|
|
|
```js
|
|
new Crawler({
|
|
appId: 'YOUR_APP_ID',
|
|
apiKey: 'YOUR_API_KEY',
|
|
rateLimit: 8,
|
|
maxDepth: 10,
|
|
startUrls: ['https://YOUR_WEBSITE_URL/'],
|
|
sitemaps: ['https://YOUR_WEBSITE_URL/sitemap-index.xml'],
|
|
ignoreCanonicalTo: true,
|
|
discoveryPatterns: ['https://YOUR_WEBSITE_URL/**'],
|
|
actions: [
|
|
{
|
|
indexName: 'YOUR_INDEX_NAME',
|
|
pathsToMatch: ['https://YOUR_WEBSITE_URL/**'],
|
|
recordExtractor: ({ $, helpers }) => {
|
|
const lvl0 =
|
|
$(".rspress-nav-menu-item.rspress-nav-menu-item-active")
|
|
.first()
|
|
.text() || "Documentation";
|
|
|
|
return helpers.docsearch({
|
|
recordProps: {
|
|
lvl0: {
|
|
selectors: "",
|
|
defaultValue: lvl0,
|
|
},
|
|
lvl1: ".rspress-doc h1",
|
|
lvl2: ".rspress-doc h2",
|
|
lvl3: ".rspress-doc h3",
|
|
lvl4: ".rspress-doc h4",
|
|
lvl5: ".rspress-doc h5",
|
|
lvl6: ".rspress-doc pre > code", // if you want to search code blocks, add this line
|
|
content: ".rspress-doc p, .rspress-doc li",
|
|
},
|
|
indexHeadings: true,
|
|
aggregateContent: true,
|
|
recordVersion: "v3",
|
|
});
|
|
},
|
|
},
|
|
],
|
|
initialIndexSettings: {
|
|
YOUR_INDEX_NAME: {
|
|
attributesForFaceting: [
|
|
'type',
|
|
'lang',
|
|
],
|
|
attributesToRetrieve: [
|
|
'hierarchy',
|
|
'content',
|
|
'anchor',
|
|
'url',
|
|
'url_without_anchor',
|
|
'type',
|
|
],
|
|
attributesToHighlight: ['hierarchy', 'content'],
|
|
attributesToSnippet: ['content:10'],
|
|
camelCaseAttributes: ['hierarchy', 'content'],
|
|
searchableAttributes: [
|
|
'unordered(hierarchy.lvl0)',
|
|
'unordered(hierarchy.lvl1)',
|
|
'unordered(hierarchy.lvl2)',
|
|
'unordered(hierarchy.lvl3)',
|
|
'unordered(hierarchy.lvl4)',
|
|
'unordered(hierarchy.lvl5)',
|
|
'unordered(hierarchy.lvl6)',
|
|
'content',
|
|
],
|
|
distinct: true,
|
|
attributeForDistinct: 'url',
|
|
customRanking: [
|
|
'desc(weight.pageRank)',
|
|
'desc(weight.level)',
|
|
'asc(weight.position)',
|
|
],
|
|
ranking: [
|
|
'words',
|
|
'filters',
|
|
'typo',
|
|
'attribute',
|
|
'proximity',
|
|
'exact',
|
|
'custom',
|
|
],
|
|
highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
|
|
highlightPostTag: '</span>',
|
|
minWordSizefor1Typo: 3,
|
|
minWordSizefor2Typos: 7,
|
|
allowTyposOnNumericTokens: false,
|
|
minProximity: 1,
|
|
ignorePlurals: true,
|
|
advancedSyntax: true,
|
|
attributeCriteriaComputedByMinProximity: true,
|
|
removeWordsIfNoResults: 'allOptional',
|
|
},
|
|
},
|
|
});
|
|
```
|
|
|
|
</div>
|
|
</details>
|
|
|
|
## pkgdown Template
|
|
|
|
<details>
|
|
<summary>pkgdown.js</summary>
|
|
<div>
|
|
|
|
```js
|
|
new Crawler({
|
|
appId: 'YOUR_APP_ID',
|
|
apiKey: 'YOUR_API_KEY',
|
|
rateLimit: 8,
|
|
maxDepth: 10,
|
|
startUrls: [
|
|
'https://YOUR_WEBSITE_URL/index.html',
|
|
'https://YOUR_WEBSITE_URL/',
|
|
'https://YOUR_WEBSITE_URL/reference',
|
|
'https://YOUR_WEBSITE_URL/articles',
|
|
],
|
|
sitemaps: ['https://YOUR_WEBSITE_URL/sitemap.xml'],
|
|
exclusionPatterns: [
|
|
'**/reference/',
|
|
'**/reference/index.html',
|
|
'**/articles/',
|
|
'**/articles/index.html',
|
|
],
|
|
discoveryPatterns: ['https://YOUR_WEBSITE_URL/**'],
|
|
actions: [
|
|
{
|
|
indexName: 'YOUR_INDEX_NAME',
|
|
pathsToMatch: ['https://YOUR_WEBSITE_URL/index.html**/**'],
|
|
recordExtractor: ({ $, helpers }) => {
|
|
// Removing DOM elements we don't want to crawl
|
|
const toRemove = '.dont-index';
|
|
$(toRemove).remove();
|
|
|
|
return helpers.docsearch({
|
|
recordProps: {
|
|
lvl0: {
|
|
selectors: '.contents h1',
|
|
defaultValue: 'YOUR_INDEX_NAME Home page',
|
|
},
|
|
lvl1: '.contents h2',
|
|
lvl2: '.contents h3',
|
|
lvl3: '.ref-arguments td, .ref-description',
|
|
content: '.contents p, .contents li, .contents .pre',
|
|
tags: {
|
|
defaultValue: ['homepage'],
|
|
},
|
|
},
|
|
indexHeadings: { from: 2, to: 6 },
|
|
aggregateContent: true,
|
|
});
|
|
},
|
|
},
|
|
{
|
|
indexName: 'YOUR_INDEX_NAME',
|
|
pathsToMatch: ['https://YOUR_WEBSITE_URL/reference**/**'],
|
|
recordExtractor: ({ $, helpers }) => {
|
|
// Removing DOM elements we don't want to crawl
|
|
const toRemove = '.dont-index';
|
|
$(toRemove).remove();
|
|
|
|
return helpers.docsearch({
|
|
recordProps: {
|
|
lvl0: {
|
|
selectors: '.contents h1',
|
|
},
|
|
lvl1: '.contents .name',
|
|
lvl2: '.ref-arguments th',
|
|
lvl3: '.ref-arguments td, .ref-description',
|
|
content: '.contents p, .contents li',
|
|
tags: {
|
|
defaultValue: ['reference'],
|
|
},
|
|
},
|
|
indexHeadings: { from: 2, to: 6 },
|
|
aggregateContent: true,
|
|
});
|
|
},
|
|
},
|
|
{
|
|
indexName: 'YOUR_INDEX_NAME',
|
|
pathsToMatch: ['https://YOUR_WEBSITE_URL/articles**/**'],
|
|
recordExtractor: ({ $, helpers }) => {
|
|
// Removing DOM elements we don't want to crawl
|
|
const toRemove = '.dont-index';
|
|
$(toRemove).remove();
|
|
|
|
return helpers.docsearch({
|
|
recordProps: {
|
|
lvl0: {
|
|
selectors: '.contents h1',
|
|
},
|
|
lvl1: '.contents .name',
|
|
lvl2: '.contents h2, .contents h3',
|
|
content: '.contents p, .contents li',
|
|
tags: {
|
|
defaultValue: ['articles'],
|
|
},
|
|
},
|
|
indexHeadings: { from: 2, to: 6 },
|
|
aggregateContent: true,
|
|
});
|
|
},
|
|
},
|
|
],
|
|
initialIndexSettings: {
|
|
YOUR_INDEX_NAME: {
|
|
attributesForFaceting: ['type', 'lang'],
|
|
attributesToRetrieve: [
|
|
'hierarchy',
|
|
'content',
|
|
'anchor',
|
|
'url',
|
|
'url_without_anchor',
|
|
],
|
|
attributesToHighlight: ['hierarchy', 'content'],
|
|
attributesToSnippet: ['content:10'],
|
|
camelCaseAttributes: ['hierarchy', 'content'],
|
|
searchableAttributes: [
|
|
'unordered(hierarchy.lvl0)',
|
|
'unordered(hierarchy.lvl1)',
|
|
'unordered(hierarchy.lvl2)',
|
|
'unordered(hierarchy.lvl3)',
|
|
'unordered(hierarchy.lvl4)',
|
|
'unordered(hierarchy.lvl5)',
|
|
'unordered(hierarchy.lvl6)',
|
|
'content',
|
|
],
|
|
distinct: true,
|
|
attributeForDistinct: 'url',
|
|
customRanking: [
|
|
'desc(weight.pageRank)',
|
|
'desc(weight.level)',
|
|
'asc(weight.position)',
|
|
],
|
|
ranking: [
|
|
'words',
|
|
'filters',
|
|
'typo',
|
|
'attribute',
|
|
'proximity',
|
|
'exact',
|
|
'custom',
|
|
],
|
|
highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
|
|
highlightPostTag: '</span>',
|
|
minWordSizefor1Typo: 3,
|
|
minWordSizefor2Typos: 7,
|
|
allowTyposOnNumericTokens: false,
|
|
minProximity: 1,
|
|
ignorePlurals: true,
|
|
advancedSyntax: true,
|
|
attributeCriteriaComputedByMinProximity: true,
|
|
removeWordsIfNoResults: 'allOptional',
|
|
separatorsToIndex: '_',
|
|
},
|
|
},
|
|
});
|
|
```
|
|
|
|
</div>
|
|
</details>
|
|
|
|
[1]: https://alg.li/discord
|
|
[2]: https://github.com/algolia/docsearch
|