Skip to content

Commit 4c7a451

Browse files
KnightNiwremCopilotKnorpelSenf
authored
fix(by copilot): demote /ref pages using facet filter instead of pageRank (#1283)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: KnorpelSenf <shtrog@gmail.com>
1 parent 826e4af commit 4c7a451

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

site/docs/.vitepress/configs/algolia/crawler.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ new Crawler({
3535
pageRank = PAGE_RANKS[secondSegment];
3636
}
3737

38+
const isReference = segments[0] === "ref" || segments[1] === "ref";
39+
3840
return helpers.docsearch({
3941
recordProps: {
4042
lvl0: {
@@ -53,6 +55,7 @@ new Crawler({
5355
lvl6: ".content h6",
5456
content: ".content p, .content li",
5557
pageRank,
58+
isReference,
5659
},
5760
indexHeadings: true,
5861
});
@@ -62,7 +65,7 @@ new Crawler({
6265
safetyChecks: { beforeIndexPublishing: { maxLostRecordsPercentage: 10 } },
6366
initialIndexSettings: {
6467
grammy: {
65-
attributesForFaceting: ["type", "lang"],
68+
attributesForFaceting: ["type", "lang", "filterOnly(isReference)"],
6669
attributesToRetrieve: [
6770
"hierarchy",
6871
"content",

site/docs/.vitepress/configs/algolia/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ export const algolia: DefaultTheme.Config["search"] = {
77
apiKey: "33782ffb584887e3b8cdf9e760ea8e60",
88
indexName: "grammy",
99
appId: "RBF5Q0D7QV",
10+
searchParameters: {
11+
optionalFilters: ["isReference:false"],
12+
},
1013
locales: {
1114
...locale.searchEn,
1215
...locale.searchEs,

0 commit comments

Comments
 (0)