Skip to content

Commit

Permalink
update: 🐛 fixed all live algolia search with crawler
Browse files Browse the repository at this point in the history
  • Loading branch information
subhadipbhowmik committed Dec 14, 2023
1 parent 8b3ab5c commit 0f716e8
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 39 deletions.
39 changes: 0 additions & 39 deletions config.json

This file was deleted.

103 changes: 103 additions & 0 deletions siteConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
new Crawler({
rateLimit: 8,
maxDepth: 10,
maxUrls: 5000,
startUrls: [
"https://subhadipbhowmik.github.io/30-Days-Of-CPP/",
"https://subhadipbhowmik.github.io/30-Days-Of-CPP/docs/",
],
renderJavaScript: false,
sitemaps: ["https://subhadipbhowmik.github.io/30-Days-Of-CPP/sitemap.xml"],
ignoreCanonicalTo: false,
discoveryPatterns: [
"https://subhadipbhowmik.github.io/30-Days-Of-CPP/docs/**",
],
schedule: "at 19:12 on Tuesday",
actions: [
{
indexName: "subhadipbhowmik",
pathsToMatch: [
"https://subhadipbhowmik.github.io/30-Days-Of-CPP/**",
"https://subhadipbhowmik.github.io/30-Days-Of-CPP/docs/**",
],
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",
});
},
},
],
safetyChecks: { beforeIndexPublishing: { maxLostRecordsPercentage: 30 } },
initialIndexSettings: {
subhadipbhowmik: {
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",
},
},
appId: "SKRAQTXG41",
apiKey: "5429a3e02c9143e12ea148b0ab9e9ac4",
extraUrls: [
"https://subhadipbhowmik.github.io/30-Days-Of-CPP/docs/intro",
"https://subhadipbhowmik.github.io/30-Days-Of-CPP/blog",
],
});

0 comments on commit 0f716e8

Please sign in to comment.